CI: make panel build optional, show apt-get errors, graceful fallbacks
Some checks failed
Release / build (push) Failing after 1m44s
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:
@@ -23,8 +23,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Install build tools
|
- name: Install build tools
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq
|
apt-get update
|
||||||
apt-get install -y -qq gcc g++ mingw-w64 zip libwebkit2gtk-4.0-dev >/dev/null 2>&1
|
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
|
- name: Install nfpm
|
||||||
run: |
|
run: |
|
||||||
@@ -35,22 +35,29 @@ jobs:
|
|||||||
- name: Build Linux binaries
|
- name: Build Linux binaries
|
||||||
run: |
|
run: |
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden ./cmd/syncwarden
|
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=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
|
- name: Build Windows binaries
|
||||||
run: |
|
run: |
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w -H=windowsgui" -o syncwarden.exe ./cmd/syncwarden
|
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=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
|
- 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
|
- name: Create Linux tarball
|
||||||
run: |
|
run: |
|
||||||
mkdir -p dist/syncwarden-${{ env.VERSION }}
|
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 README.md CHANGELOG.md LICENSE dist/syncwarden-${{ env.VERSION }}/
|
||||||
cp packaging/linux/syncwarden.desktop 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 }}
|
tar -czf syncwarden_${{ env.VERSION }}_linux_amd64.tar.gz -C dist syncwarden-${{ env.VERSION }}
|
||||||
@@ -58,7 +65,8 @@ jobs:
|
|||||||
- name: Create Windows zip
|
- name: Create Windows zip
|
||||||
run: |
|
run: |
|
||||||
mkdir -p dist-win/syncwarden-${{ env.VERSION }}
|
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 }}/
|
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 }}
|
cd dist-win && zip -r ../syncwarden_${{ env.VERSION }}_windows_amd64.zip syncwarden-${{ env.VERSION }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user