Extend documentation to include GTK4 variant #54
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 ${{ matrix.variant }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
variant: | |
- gtk3 | |
- gtk4 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine image hash | |
id: docker-image-hash | |
shell: bash | |
run: | | |
cd ./.github/workflows/docker-linux-${{ matrix.variant }}/ | |
hash="$(find . -type f | sort | xargs -i sha1sum {} | sha1sum | head -c 40)" | |
echo "hash=${hash}" >> $GITHUB_OUTPUT | |
- name: Set up cache | |
id: cache-docker-image | |
uses: actions/cache@v4 | |
with: | |
path: docker/build-linux-${{ matrix.variant }}.tar | |
key: docker-image-build-linux-${{ matrix.variant }}-${{ steps.docker-image-hash.outputs.hash }} | |
- name: Update container image | |
if: steps.cache-docker-image.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ./docker | |
docker build -t build-linux-${{ matrix.variant }}:latest ./.github/workflows/docker-linux-${{ matrix.variant }}/ | |
docker image save build-linux-${{ matrix.variant }}:latest --output ./docker/build-linux-${{ matrix.variant }}.tar | |
- name: Load container image | |
if: steps.cache-docker-image.outputs.cache-hit == 'true' | |
run: | | |
docker image load --input ./docker/build-linux-${{ matrix.variant }}.tar | |
- name: Create build directory | |
run: | | |
mkdir ./build | |
- name: Build in container | |
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3.0.0 | |
with: | |
image: build-linux-${{ matrix.variant }}:latest | |
options: -v ${{ github.workspace }}:/workspace | |
run: | | |
bash ./workspace/.github/workflows/build-master-linux-${{ matrix.variant }}.sh | |
- 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@v4 | |
with: | |
name: linux-${{ matrix.variant }} | |
path: ./build/*.zip | |
build-windows: | |
name: Build (Windows) | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Download toolchain | |
run: | | |
$ToolchainVersion = "20240903" | |
$ToolchainSHA256 = "879ae28c8c38df8a18b5a152a1154ffb87860e6eedc5f8fbd2f66184ef21e3c8" | |
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 -ldflags "-s -w" -o .\build\x86-64\dsl.exe .\cmd | |
- name: Build CLI (x86) | |
env: | |
CGO_ENABLED: 0 | |
GOARCH: 386 | |
run: | | |
go build -ldflags "-s -w" -o .\build\x86\dsl.exe .\cmd | |
- name: Build CLI (arm64) | |
env: | |
CGO_ENABLED: 0 | |
GOARCH: arm64 | |
run: | | |
go build -ldflags "-s -w" -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="-s -w -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="-s -w -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="-s -w -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@v4 | |
with: | |
name: windows | |
path: ./build/*.zip | |
build-macos: | |
name: Build (macOS) | |
runs-on: macos-14 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Build CLI | |
env: | |
CGO_ENABLED: 0 | |
run: | | |
GOARCH=amd64 go build -ldflags "-s -w" -o ./build/universal/dsl-x86-64 ./cmd | |
GOARCH=arm64 go build -ldflags "-s -w" -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 | |
cat << 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 | |
GOARCH=amd64 MACOSX_DEPLOYMENT_TARGET=10.15 \ | |
go build -tags gui -ldflags "-s -w" -o ./build/universal/dsl-gui-x86-64 ./cmd | |
GOARCH=arm64 MACOSX_DEPLOYMENT_TARGET=11.0 \ | |
go build -tags gui -ldflags "-s -w" -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@v4 | |
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@v4 | |
- 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@v4 | |
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@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 | |
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 }}) | |
Choose the build for your platform and processor architecture from the assets below: | |
- **Linux:** | |
For recent Linux distribution releases, try the GTK4 variant first. Older distribution releases require the GTK3 variant. | |
If unsure, pick the x86-64 architecture version. | |
- **Windows:** | |
Computers running Windows 10 and Windows 11 are supported. | |
The x86-64 architecture is probably the right choice, unless you are using a recent device with an ARM64 processor. | |
- **macOS:** | |
All devices running Mac OS X 10.15 or newer should work. | |
Both Intel (x86-64) and Apple silicon (ARM64) are supported by a universal build. | |
*Note: If you want to get the corresponding source code please use Git.\ | |
The source archives linked below don't contain the actual source.* |