From 126065e705832384840faa36bf359c401b23bc20 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Sun, 4 Oct 2026 08:07:14 +0000 Subject: [PATCH] ci: run the workflow on GitHub pull requests Add .github/workflows/ci.yml, a copy of the Forgejo CI workflow adapted to GitHub-hosted runners (ubuntu-latest + cachix/install-nix-action), so pull requests on the GitHub mirror get the lint, unit-test and integration checks. The GitHub copy uses a 90 minute timeout so a cold run can finish and warm the caches, caps the Nix cache so it cannot evict the Gradle/music caches from GitHub's 10 GB per-repo budget, and pins the job token to contents:read. --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..89f46cb3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +env: + GRADLE_OPTS: -Dorg.gradle.daemon=false + NIX_CONFIG: experimental-features = nix-command flakes + +defaults: + run: + shell: sh + +jobs: + ci: + runs-on: ubuntu-latest + timeout-minutes: 90 + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1 + - uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7.0.2 + with: + primary-key: nix-v2-${{ hashFiles('flake.lock', '**/*.nix') }} + restore-prefixes-first-match: nix-v2- + gc-max-store-size-linux: 6G + - uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', 'gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties') }} + restore-keys: gradle- + - uses: actions/cache@v4 + with: + path: .integration/music + key: integration-music-v1 + - run: nix develop --command gradle :app:ktlintCheck :app:lintDebug :app:testDebugUnitTest --no-configuration-cache --console=plain + - run: nix develop .#integration --command nu tools/integration-test.nu