Fix error handling in GUI #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build master binaries | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build-linux: | |
name: Build (Linux) | |
runs-on: ubuntu-latest | |
container: | |
image: ubuntu:18.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
- name: Install dependencies | |
run: | | |
cat << EOF > /etc/apt/sources.list | |
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu/ bionic main universe | |
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ bionic main universe | |
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu/ bionic-updates main universe | |
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main universe | |
deb [arch=amd64,i386] http://security.ubuntu.com/ubuntu/ bionic-security main universe | |
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ bionic-security main universe | |
EOF | |
dpkg --add-architecture i386 | |
dpkg --add-architecture armhf | |
dpkg --add-architecture arm64 | |
apt update | |
apt install --no-install-recommends -y \ | |
ca-certificates zip \ | |
build-essential \ | |
gcc-7-multilib g++-7-multilib \ | |
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \ | |
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
- name: Build CLI | |
env: | |
CGO_ENABLED: 0 | |
run: | | |
GOARCH=amd64 go build -o ./build/x86-64/dsl ./cmd | |
GOARCH=386 go build -o ./build/x86/dsl ./cmd | |
GOARCH=arm GOARM=6 go build -o ./build/arm/dsl ./cmd | |
GOARCH=arm64 go build -o ./build/arm64/dsl ./cmd | |
- name: Build GUI (x86-64) | |
env: | |
CGO_ENABLED: 1 | |
GOARCH: amd64 | |
run: | | |
apt install --no-install-recommends -y libgtk-3-dev libwebkit2gtk-4.0-dev | |
go build -tags gui -o ./build/x86-64/dsl-gui ./cmd | |
apt remove -y libgtk-3-dev libwebkit2gtk-4.0-dev | |
- name: Build GUI (x86) | |
env: | |
PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig | |
CGO_ENABLED: 1 | |
GOARCH: 386 | |
run: | | |
apt install --no-install-recommends -y libgtk-3-dev:i386 libwebkit2gtk-4.0-dev:i386 | |
go build -tags gui -o ./build/x86/dsl-gui ./cmd | |
apt remove -y libgtk-3-dev:i386 libwebkit2gtk-4.0-dev:i386 | |
- name: Build GUI (arm) | |
env: | |
CC: arm-linux-gnueabihf-gcc | |
CXX: arm-linux-gnueabihf-g++ | |
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig | |
CGO_ENABLED: 1 | |
GOARCH: arm | |
GOARM: 6 | |
run: | | |
apt install --no-install-recommends -y libgtk-3-dev:armhf libwebkit2gtk-4.0-dev:armhf | |
go build -tags gui -o ./build/arm/dsl-gui ./cmd | |
apt remove -y libgtk-3-dev:armhf libwebkit2gtk-4.0-dev:armhf | |
- name: Build GUI (arm64) | |
env: | |
CC: aarch64-linux-gnu-gcc | |
CXX: aarch64-linux-gnu-g++ | |
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig | |
CGO_ENABLED: 1 | |
GOARCH: arm64 | |
run: | | |
apt install --no-install-recommends -y libgtk-3-dev:arm64 libwebkit2gtk-4.0-dev:arm64 | |
go build -tags gui -o ./build/arm64/dsl-gui ./cmd | |
apt remove -y libgtk-3-dev:arm64 libwebkit2gtk-4.0-dev:arm64 | |
- name: Zip | |
run: | | |
for folder in "$PWD"/build/*/; do | |
name="$(basename "$folder")" | |
cd "$folder" | |
zip -r "../$name.zip" ./* | |
done | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux | |
path: ./build/*.zip | |
build-windows: | |
name: Build (Windows) | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
- name: Download toolchain | |
run: | | |
$ToolchainVersion = "20231128" | |
$ToolchainSHA256 = "7a344dafa6942de2c1f4643b3eb5c5ce5317fbab671a887e4d39f326b331798f" | |
New-Item -ItemType Directory .\toolchain | |
$ProgressPreference = "SilentlyContinue" | |
Invoke-WebRequest "https://github.com/mstorsjo/llvm-mingw/releases/download/$ToolchainVersion/llvm-mingw-$ToolchainVersion-ucrt-x86_64.zip" -OutFile .\toolchain\llvm-mingw.zip | |
$actualSHA256 = Get-FileHash -Algorithm SHA256 .\toolchain\llvm-mingw.zip | |
if ($actualSHA256.Hash -ne $ToolchainSHA256) { | |
Write-Output "Toolchain checksum does not match!" | |
exit 1 | |
} | |
Expand-Archive .\toolchain\llvm-mingw.zip .\toolchain | |
Move-Item ".\toolchain\llvm-mingw-$ToolchainVersion-ucrt-x86_64" .\toolchain\llvm-mingw | |
- name: Build CLI (x86-64) | |
env: | |
CGO_ENABLED: 0 | |
GOARCH: amd64 | |
run: | | |
go build -o .\build\x86-64\dsl.exe .\cmd | |
- name: Build CLI (x86) | |
env: | |
CGO_ENABLED: 0 | |
GOARCH: 386 | |
run: | | |
go build -o .\build\x86\dsl.exe .\cmd | |
- name: Build CLI (arm64) | |
env: | |
CGO_ENABLED: 0 | |
GOARCH: arm64 | |
run: | | |
go build -o .\build\arm64\dsl.exe .\cmd | |
- name: Build GUI (x86-64) | |
env: | |
CC: x86_64-w64-mingw32-clang | |
CXX: x86_64-w64-mingw32-clang++ | |
CGO_ENABLED: 1 | |
GOARCH: amd64 | |
run: | | |
$Env:Path = "$PWD\toolchain\llvm-mingw\bin;$Env:Path" | |
go build -tags gui -ldflags="-H windowsgui" -o .\build\x86-64\dsl-gui.exe .\cmd | |
- name: Build GUI (x86) | |
env: | |
CC: i686-w64-mingw32-clang | |
CXX: i686-w64-mingw32-clang++ | |
CGO_ENABLED: 1 | |
GOARCH: 386 | |
run: | | |
$Env:Path = "$PWD\toolchain\llvm-mingw\bin;$Env:Path" | |
go build -tags gui -ldflags="-H windowsgui" -o .\build\x86\dsl-gui.exe .\cmd | |
- name: Build GUI (arm64) | |
env: | |
CC: aarch64-w64-mingw32-clang | |
CXX: aarch64-w64-mingw32-clang++ | |
CGO_ENABLED: 1 | |
GOARCH: arm64 | |
run: | | |
$Env:Path = "$PWD\toolchain\llvm-mingw\bin;$Env:Path" | |
go build -tags gui -ldflags="-H windowsgui" -o .\build\arm64\dsl-gui.exe .\cmd | |
- name: Zip | |
run: | | |
foreach ($folder in $(Get-ChildItem -Directory .\build)) { | |
Set-Location $folder.FullName | |
Compress-Archive .\* "..\$($folder.Name).zip" | |
} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows | |
path: ./build/*.zip | |
build-macos: | |
name: Build (macOS) | |
runs-on: macos-11 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
- name: Build CLI | |
env: | |
CGO_ENABLED: 0 | |
run: | | |
GOARCH=amd64 go build -o ./build/universal/dsl-x86-64 ./cmd | |
GOARCH=arm64 go build -o ./build/universal/dsl-arm64 ./cmd | |
lipo -create -output ./build/universal/dsl ./build/universal/dsl-x86-64 ./build/universal/dsl-arm64 | |
rm ./build/universal/dsl-x86-64 ./build/universal/dsl-arm64 | |
- name: Build GUI | |
env: | |
CGO_ENABLED: 1 | |
run: | | |
mkdir -p ./build/universal/dsl-gui.app/Contents/MacOS | |
echo << EOF > ./build/universal/dsl-gui.app/Contents/Info.plist | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleExecutable</key> | |
<string>dsl-gui</string> | |
<key>CFBundleIdentifier</key> | |
<string>eu.3e8.go.dsl</string> | |
</dict> | |
</plist> | |
EOF | |
sudo xcode-select -s /Applications/Xcode_11.7.app | |
GOARCH=amd64 SDKROOT="$(xcrun --sdk macosx10.15 --show-sdk-path)" \ | |
go build -tags gui -o ./build/universal/dsl-gui-x86-64 ./cmd | |
sudo xcode-select -s /Applications/Xcode_12.4.app | |
GOARCH=arm64 SDKROOT="$(xcrun --sdk macosx11.1 --show-sdk-path)" \ | |
go build -tags gui -o ./build/universal/dsl-gui-arm64 ./cmd | |
lipo -create -output ./build/universal/dsl-gui.app/Contents/MacOS/dsl-gui \ | |
./build/universal/dsl-gui-x86-64 ./build/universal/dsl-gui-arm64 | |
rm ./build/universal/dsl-gui-x86-64 ./build/universal/dsl-gui-arm64 | |
- name: Zip | |
run: | | |
for folder in "$PWD"/build/*/; do | |
name="$(basename "$folder")" | |
cd "$folder" | |
zip -r "../$name.zip" ./* | |
done | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos | |
path: ./build/*.zip | |
release: | |
name: Package and release | |
runs-on: ubuntu-latest | |
needs: | |
- build-linux | |
- build-windows | |
- build-macos | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Determine variables | |
id: vars | |
shell: bash | |
env: | |
TZ: UTC0 | |
run: | | |
echo "version=$(git log -1 --format='%cd+%h' --date='format-local:%Y-%m-%d')" >> $GITHUB_OUTPUT | |
echo "time=$(git log -1 --format='%cd' --date='format-local:%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT | |
- name: Prepare common files | |
run: | | |
mkdir -p ./build/template | |
echo "${{ steps.vars.outputs.version }}" > ./build/template/VERSION | |
cp LICENSE ./build/template/ | |
cp ./cmd/LICENSE-3RD-PARTY ./build/template/ | |
cp README.md ./build/template/ | |
mkdir ./build/template/docs | |
cp ./docs/*.md ./build/template/docs/ | |
- name: Install pandoc | |
run: | | |
sudo apt update | |
sudo apt install -y pandoc | |
- name: Build HTML documentation | |
run: | | |
./docs/build.sh ./build/template | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./artifacts | |
- name: Build archives | |
shell: bash | |
run: | | |
cd ./build | |
for artifact in ../artifacts/*/*.zip; do | |
target="$(basename "$(dirname "$artifact")")" | |
arch="$(basename -s ".zip" "$artifact")" | |
name="dsl_${{ steps.vars.outputs.version }}_${target}_${arch}" | |
cp -r ./template "./$name" | |
unzip "../artifacts/$target/$arch.zip" -d "./$name/" | |
zip -r "$name.zip" "$name" | |
done | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: github-master-builds | |
prerelease: true | |
allowUpdates: true | |
removeArtifacts: true | |
artifacts: "./build/*.zip" | |
artifactContentType: application/zip | |
name: Auto-built binaries | |
body: | | |
These binaries are automatically built from the master branch.\ | |
Current version: ${{ github.sha }} (${{ steps.vars.outputs.time }}) | |
Select the build for your platform from the assets below. | |
*Note: If you want to get the corresponding source code please use Git.\ | |
The source archives linked below don't contain the actual source.* |