CI: make panel build optional, show apt-get errors, graceful fallbacks
Some checks failed
Release / build (push) Failing after 1m44s

If CGO dependencies are missing, panel builds are skipped with a warning
and the tray binary falls back to opening the browser.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Axel Meyer
2026-03-03 22:00:06 +01:00
parent 6149a82d0b
commit 9a2cec8e21

View File

@@ -23,8 +23,8 @@ jobs:
- name: Install build tools
run: |
apt-get update -qq
apt-get install -y -qq gcc g++ mingw-w64 zip libwebkit2gtk-4.0-dev >/dev/null 2>&1
apt-get update
apt-get install -y gcc g++ mingw-w64 zip libwebkit2gtk-4.0-dev || apt-get install -y gcc g++ mingw-w64 zip
- name: Install nfpm
run: |
@@ -35,22 +35,29 @@ jobs:
- name: Build Linux binaries
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden ./cmd/syncwarden
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden-panel ./cmd/panel
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden-setup ./cmd/setup
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden-panel ./cmd/panel || echo "WARN: Linux panel build skipped (missing webkit2gtk-dev)"
- name: Build Windows binaries
run: |
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w -H=windowsgui" -o syncwarden.exe ./cmd/syncwarden
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -trimpath -ldflags="-s -w -H=windowsgui" -o syncwarden-panel.exe ./cmd/panel
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden-setup.exe ./cmd/setup
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -trimpath -ldflags="-s -w -H=windowsgui" -o syncwarden-panel.exe ./cmd/panel || echo "WARN: Windows panel build skipped (missing mingw-w64)"
- name: Build .deb package
run: VERSION=${{ env.VERSION }} nfpm package --config packaging/nfpm.yaml --packager deb --target syncwarden_${{ env.VERSION }}_amd64.deb
run: |
if [ -f syncwarden-panel ]; then
VERSION=${{ env.VERSION }} nfpm package --config packaging/nfpm.yaml --packager deb --target syncwarden_${{ env.VERSION }}_amd64.deb
else
sed '/syncwarden-panel/d' packaging/nfpm.yaml > /tmp/nfpm-nopanel.yaml
VERSION=${{ env.VERSION }} nfpm package --config /tmp/nfpm-nopanel.yaml --packager deb --target syncwarden_${{ env.VERSION }}_amd64.deb
fi
- name: Create Linux tarball
run: |
mkdir -p dist/syncwarden-${{ env.VERSION }}
cp syncwarden syncwarden-panel syncwarden-setup dist/syncwarden-${{ env.VERSION }}/
cp syncwarden syncwarden-setup dist/syncwarden-${{ env.VERSION }}/
[ -f syncwarden-panel ] && cp syncwarden-panel dist/syncwarden-${{ env.VERSION }}/ || true
cp README.md CHANGELOG.md LICENSE dist/syncwarden-${{ env.VERSION }}/
cp packaging/linux/syncwarden.desktop dist/syncwarden-${{ env.VERSION }}/
tar -czf syncwarden_${{ env.VERSION }}_linux_amd64.tar.gz -C dist syncwarden-${{ env.VERSION }}
@@ -58,7 +65,8 @@ jobs:
- name: Create Windows zip
run: |
mkdir -p dist-win/syncwarden-${{ env.VERSION }}
cp syncwarden.exe syncwarden-panel.exe syncwarden-setup.exe dist-win/syncwarden-${{ env.VERSION }}/
cp syncwarden.exe syncwarden-setup.exe dist-win/syncwarden-${{ env.VERSION }}/
[ -f syncwarden-panel.exe ] && cp syncwarden-panel.exe dist-win/syncwarden-${{ env.VERSION }}/ || true
cp README.md CHANGELOG.md LICENSE dist-win/syncwarden-${{ env.VERSION }}/
cd dist-win && zip -r ../syncwarden_${{ env.VERSION }}_windows_amd64.zip syncwarden-${{ env.VERSION }}