CI #52
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 4 * * 1' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| changes: | |
| name: Detect changes | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| go: ${{ steps.force.outputs.run == 'true' || steps.filter.outputs.go == 'true' }} | |
| validate: ${{ steps.force.outputs.run == 'true' || steps.filter.outputs.validate == 'true' }} | |
| build: ${{ steps.force.outputs.run == 'true' || steps.filter.outputs.build == 'true' }} | |
| aur: ${{ steps.force.outputs.run == 'true' || steps.filter.outputs.aur == 'true' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 100 | |
| persist-credentials: false | |
| - name: Run all checks for scheduled/manual workflows | |
| id: force | |
| run: | | |
| case "${{ github.event_name }}" in | |
| schedule|workflow_dispatch) printf 'run=true\n' >> "$GITHUB_OUTPUT" ;; | |
| *) printf 'run=false\n' >> "$GITHUB_OUTPUT" ;; | |
| esac | |
| - name: Detect changed paths | |
| id: filter | |
| uses: dorny/paths-filter@v4 | |
| with: | |
| filters: | | |
| go: | |
| - 'justfile' | |
| - 'VERSION' | |
| - 'proto/**' | |
| - 'whatevrd/**' | |
| - '.github/workflows/**' | |
| validate: | |
| - 'justfile' | |
| - 'VERSION' | |
| - 'scripts/release.py' | |
| - 'whatkevr/data/**' | |
| - '.github/workflows/**' | |
| build: | |
| - 'justfile' | |
| - 'VERSION' | |
| - 'proto/**' | |
| - 'whatevrd/**' | |
| - 'whatkevr/**' | |
| - 'packaging/systemd/**' | |
| - '.github/workflows/**' | |
| aur: | |
| - 'packaging/aur/**' | |
| - 'scripts/release.py' | |
| - 'scripts/render_aur_release.py' | |
| - '.github/workflows/**' | |
| go: | |
| name: Go daemon | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: changes | |
| if: ${{ needs.changes.outputs.go == 'true' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: whatevrd/go.mod | |
| cache-dependency-path: whatevrd/go.sum | |
| - name: Check formatting | |
| working-directory: whatevrd | |
| run: | | |
| files="$(gofmt -l .)" | |
| if [ -n "$files" ]; then | |
| printf '%s\n' "$files" | |
| exit 1 | |
| fi | |
| - name: Vet | |
| working-directory: whatevrd | |
| # sqlite_fts5 enables the FTS5 module in go-sqlite3, required by the | |
| # message-search index the store creates on open. | |
| run: go vet -tags sqlite_fts5 ./... | |
| - name: Test | |
| working-directory: whatevrd | |
| run: go test -tags sqlite_fts5 ./... | |
| validate: | |
| name: Validate metadata | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: changes | |
| if: ${{ needs.changes.outputs.validate == 'true' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install validators | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| just desktop-file-utils appstream libxml2-utils | |
| - name: Validate desktop entry and metainfo | |
| run: just validate | |
| build-arch: | |
| name: Build and install (Arch) | |
| runs-on: ubuntu-latest | |
| container: archlinux:latest | |
| timeout-minutes: 60 | |
| needs: changes | |
| if: ${{ needs.changes.outputs.build == 'true' }} | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| pacman -Syu --noconfirm --needed \ | |
| git sudo base-devel go just cmake ninja ccache extra-cmake-modules zstd vulkan-headers \ | |
| qt6-base qt6-declarative qt6-shadertools qt6-grpc \ | |
| kcoreaddons kdbusaddons ki18n kirigami kirigami-addons prison qqc2-desktop-style sqlite | |
| useradd -m -G wheel builduser | |
| printf 'builduser ALL=(ALL) NOPASSWD: ALL\n' >> /etc/sudoers | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Set rlottie cache key | |
| id: rlottie-cache-key | |
| run: printf 'week=%s\n' "$(date -u +%G-%V)" >> "$GITHUB_OUTPUT" | |
| - name: Restore rlottie package | |
| uses: actions/cache@v5 | |
| with: | |
| path: .cache/aur/rlottie | |
| key: arch-rlottie-${{ steps.rlottie-cache-key.outputs.week }} | |
| - name: Install rlottie | |
| run: | | |
| install -d "$GITHUB_WORKSPACE/.cache/aur/rlottie" | |
| shopt -s nullglob | |
| cached=("$GITHUB_WORKSPACE"/.cache/aur/rlottie/rlottie-*.pkg.tar*) | |
| if ((${#cached[@]})) && pacman -U --noconfirm "${cached[@]}"; then | |
| exit 0 | |
| fi | |
| rm -f "$GITHUB_WORKSPACE"/.cache/aur/rlottie/rlottie-*.pkg.tar* | |
| rm -rf "$RUNNER_TEMP/rlottie" | |
| git clone https://aur.archlinux.org/rlottie.git "$RUNNER_TEMP/rlottie" | |
| chown -R builduser:builduser "$RUNNER_TEMP/rlottie" | |
| cd "$RUNNER_TEMP/rlottie" | |
| sudo -u builduser makepkg -s --noconfirm | |
| cp rlottie-*.pkg.tar* "$GITHUB_WORKSPACE/.cache/aur/rlottie/" | |
| pacman -U --noconfirm "$GITHUB_WORKSPACE"/.cache/aur/rlottie/rlottie-*.pkg.tar* | |
| - name: Restore Go caches | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| key: arch-go-${{ hashFiles('whatevrd/go.sum') }} | |
| restore-keys: arch-go- | |
| - name: Restore ccache | |
| uses: actions/cache@v5 | |
| with: | |
| path: .cache/ccache | |
| key: arch-ccache-${{ github.sha }} | |
| restore-keys: arch-ccache- | |
| - name: Build | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.cache/ccache | |
| CCACHE_MAXSIZE: 500M | |
| CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
| run: just build | |
| - name: Install smoke test | |
| run: just install-dev /usr "$RUNNER_TEMP/pkgroot" | |
| - name: Show resolved version | |
| run: just version | |
| aur: | |
| name: AUR metadata | |
| runs-on: ubuntu-latest | |
| container: archlinux:latest | |
| timeout-minutes: 20 | |
| needs: changes | |
| if: ${{ needs.changes.outputs.aur == 'true' }} | |
| steps: | |
| - name: Install packaging tools | |
| run: | | |
| pacman -Syu --noconfirm --needed git sudo base-devel namcap | |
| useradd -m -G wheel builduser | |
| printf 'builduser ALL=(ALL) NOPASSWD: ALL\n' >> /etc/sudoers | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Check package metadata | |
| run: | | |
| chown -R builduser:builduser "$GITHUB_WORKSPACE" | |
| for dir in "$GITHUB_WORKSPACE"/packaging/aur/*; do | |
| cd "$dir" | |
| sudo -u builduser makepkg --printsrcinfo > .SRCINFO.generated | |
| diff -u .SRCINFO .SRCINFO.generated | |
| namcap PKGBUILD | |
| done |