From a0966f6d2ee5b3a77ac0bd7227b57580886c7f2f Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 8 Jan 2022 09:36:33 +1300 Subject: [PATCH 1/4] Update flake auto-update cron schedule to run twice a week --- .github/workflows/update-flake-lock.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-flake-lock.yml b/.github/workflows/update-flake-lock.yml index e53ba93..5a3d232 100644 --- a/.github/workflows/update-flake-lock.yml +++ b/.github/workflows/update-flake-lock.yml @@ -2,7 +2,7 @@ name: update-flake-lock on: workflow_dispatch: # allows manual triggering schedule: - - cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 + - cron: '0 0 * * 1,4' # Run twice a week jobs: lockfile: From 1c6887b5bf8b9156bc4531d03bd13dbcd4b8414f Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 8 Jan 2022 21:14:05 +1300 Subject: [PATCH 2/4] ci: Remove cron schedules We're using a pinned auto-updater workflow instead which is deterministic. --- .github/workflows/test-flakes.yml | 2 -- .github/workflows/test.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/test-flakes.yml b/.github/workflows/test-flakes.yml index 8b8d29f..ea6de78 100644 --- a/.github/workflows/test-flakes.yml +++ b/.github/workflows/test-flakes.yml @@ -4,8 +4,6 @@ on: push: branches: - main - schedule: - - cron: '51 2 * * *' jobs: tests: strategy: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce115e5..44c6488 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,8 +4,6 @@ on: push: branches: - main - schedule: - - cron: '51 2 * * *' jobs: tests: strategy: From 5b9621cd6ce89cb5451376e2d0aa44d8c48b657e Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 8 Jan 2022 21:22:01 +1300 Subject: [PATCH 3/4] Remove old tests and add development workflow tests --- .../workflows/{test.yml => test-develop-classic.yml} | 10 +++++++--- .../{test-flakes.yml => test-develop-flakes.yml} | 10 +++------- 2 files changed, 10 insertions(+), 10 deletions(-) rename .github/workflows/{test.yml => test-develop-classic.yml} (50%) rename .github/workflows/{test-flakes.yml => test-develop-flakes.yml} (60%) diff --git a/.github/workflows/test.yml b/.github/workflows/test-develop-classic.yml similarity index 50% rename from .github/workflows/test.yml rename to .github/workflows/test-develop-classic.yml index 44c6488..0455e30 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-develop-classic.yml @@ -1,4 +1,4 @@ -name: "Test" +name: "Development workflow - nix-shell" on: pull_request: push: @@ -13,5 +13,9 @@ jobs: steps: - uses: actions/checkout@v2 - uses: cachix/install-nix-action@v16 - - name: build - run: NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz nix-build --expr '(import { }).callPackage ./. { }' + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Build + run: nix-shell --run 'meson build && cd build && ninja' + - name: Run tests + run: nix-shell --run 'pytest ./tests' diff --git a/.github/workflows/test-flakes.yml b/.github/workflows/test-develop-flakes.yml similarity index 60% rename from .github/workflows/test-flakes.yml rename to .github/workflows/test-develop-flakes.yml index ea6de78..b4c0afa 100644 --- a/.github/workflows/test-flakes.yml +++ b/.github/workflows/test-develop-flakes.yml @@ -1,4 +1,4 @@ -name: "Flake test" +name: "Development workflow - flakes" on: pull_request: push: @@ -16,11 +16,7 @@ jobs: # Nix Flakes doesn't work on shallow clones fetch-depth: 0 - uses: cachix/install-nix-action@v16 - - name: List flake structure - run: nix flake show - name: Build - run: nix build --out-link result + run: nix develop -c bash -c 'meson build && cd build && ninja' - name: Run tests - run: | - nix develop -c install -D ./result/bin/nix-eval-jobs ./build/src/nix-eval-jobs - nix develop -c pytest ./tests + run: nix develop -c pytest ./tests From 49020f2dc855621d249da0b41f78d862cc66d72f Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 8 Jan 2022 21:42:19 +1300 Subject: [PATCH 4/4] ci: Use a dynamic matrix generated from flake checks for github actions --- .github/workflows/flake-check.yml | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/flake-check.yml diff --git a/.github/workflows/flake-check.yml b/.github/workflows/flake-check.yml new file mode 100644 index 0000000..839ad02 --- /dev/null +++ b/.github/workflows/flake-check.yml @@ -0,0 +1,45 @@ +name: "Flake checks" +on: + pull_request: + push: + branches: + - main +jobs: + + flake-checks: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v2.4.0 + with: + # Nix Flakes doesn't work on shallow clones + fetch-depth: 0 + - uses: cachix/install-nix-action@v16 + with: + nix_path: nixpkgs=channel:nixos-unstable + - id: set-matrix + run: | + set -euo pipefail + + matrix="$(nix flake show --json | jq '.checks."x86_64-linux" | keys' | jq -rcM '{attr: ., os: ["ubuntu-latest", "macos-latest"]}')" + echo "::set-output name=matrix::$matrix" + + builds: + needs: flake-checks + runs-on: ${{ matrix.os }} + strategy: + matrix: ${{fromJSON(needs.flake-checks.outputs.matrix)}} + steps: + - uses: actions/checkout@v2.4.0 + with: + # Nix Flakes doesn't work on shallow clones + fetch-depth: 0 + - uses: cachix/install-nix-action@v16 + with: + nix_path: nixpkgs=channel:nixos-unstable + - run: | + set -euo pipefail + + system=$(nix-instantiate --eval --expr builtins.currentSystem | jq -r) + nix build -L .#checks.$system.${{ matrix.attr }}