Build release assets #1
Workflow file for this run
This file contains hidden or 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 release assets | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-${{ github.event.release.tag_name }} | |
| cancel-in-progress: false | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name }} | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| cache: pip | |
| - name: Install Qt runtime libraries | |
| run: sudo apt-get update && sudo apt-get install -y libegl1 libgl1 libxkbcommon-x11-0 libxcb-cursor0 | |
| - name: Install test dependencies | |
| run: python -m pip install --disable-pip-version-check -r requirements-dev.txt | |
| - name: Verify tag and version | |
| run: python scripts/verify_release.py --tag "${{ github.event.release.tag_name }}" | |
| - name: Ruff | |
| run: python -m ruff check cameracopy2 tests scripts | |
| - name: Test | |
| env: | |
| QT_QPA_PLATFORM: offscreen | |
| run: python -W error -m pytest | |
| linux: | |
| needs: validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name }} | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: stable | |
| cache: false | |
| - name: Install nFPM | |
| run: | | |
| go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.47.0 | |
| echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | |
| - name: Install package inspection tools | |
| run: sudo apt-get update && sudo apt-get install -y desktop-file-utils rpm zstd | |
| - name: Build Linux packages | |
| run: scripts/package-linux.sh release-assets | |
| - name: Inspect Linux package contents | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| dpkg-deb --info release-assets/*.deb | |
| dpkg-deb --contents release-assets/*.deb | grep -F ./usr/bin/cameracopy | |
| ! dpkg-deb --contents release-assets/*.deb | grep -E '(__pycache__/|\.py[co]$)' | |
| rm -rf package-root | |
| mkdir package-root | |
| dpkg-deb --extract release-assets/*.deb package-root | |
| test -x package-root/usr/bin/cameracopy | |
| desktop-file-validate package-root/usr/share/applications/cameracopy.desktop | |
| PACKAGE_VERSION="$(cat VERSION)" | |
| PYTHONPATH="$PWD/package-root/usr/lib/cameracopy" python -c \ | |
| "import cameracopy2; assert cameracopy2.__version__ == '$PACKAGE_VERSION'" | |
| rpm -qpl release-assets/*.rpm | grep -F /usr/bin/cameracopy | |
| ! rpm -qpl release-assets/*.rpm | grep -E '(__pycache__/|\.py[co]$)' | |
| tar --zstd -tf release-assets/*.pkg.tar.zst | grep -F usr/bin/cameracopy | |
| tar --zstd -tf release-assets/*.pkg.tar.zst | grep -F usr/share/icons/hicolor/128x128/apps/cameracopy.png | |
| ! tar --zstd -tf release-assets/*.pkg.tar.zst | grep -E '(__pycache__/|\.py[co]$)' | |
| for listing in \ | |
| "dpkg-deb --contents release-assets/*.deb" \ | |
| "rpm -qplv release-assets/*.rpm" \ | |
| "tar --zstd -tvf release-assets/*.pkg.tar.zst"; do | |
| if eval "$listing" | awk '$1 ~ /^d/ && $1 ~ /[sStT]/ { print; bad=1 } END { exit bad }'; then | |
| echo "Package directory modes are normalized: $listing" | |
| else | |
| echo "Package contains directories with special permission bits: $listing" >&2 | |
| exit 1 | |
| fi | |
| done | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: linux-release-assets | |
| path: release-assets/* | |
| if-no-files-found: error | |
| linux-install-test: | |
| needs: linux | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 35 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [debian, ubuntu, fedora, arch] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name }} | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| name: linux-release-assets | |
| path: release-assets | |
| - name: Install and smoke-test package on ${{ matrix.target }} | |
| run: scripts/test-linux-packages.sh release-assets "${{ matrix.target }}" | |
| windows: | |
| needs: validate | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name }} | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| cache: pip | |
| - name: Install NSIS | |
| shell: powershell | |
| run: choco install nsis --yes --no-progress | |
| - name: Build Windows executable and installer | |
| shell: powershell | |
| run: .\scripts\build-windows.ps1 -OutputDirectory release-assets | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: windows-release-assets | |
| path: release-assets/* | |
| if-no-files-found: error | |
| compression-level: 0 | |
| publish: | |
| needs: [linux-install-test, windows] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name }} | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| pattern: "*-release-assets" | |
| path: release-assets | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: python scripts/generate_checksums.py release-assets --output release-assets/SHA256SUMS.txt | |
| - name: Upload assets to GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release upload "${{ github.event.release.tag_name }}" release-assets/* --clobber |