From e9456a0e3061d02c4d3c5a5137105f3dc3635724 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Mon, 13 Apr 2026 09:36:45 +0300 Subject: [PATCH 1/4] Run stack-test regularly to keep cache warm --- .github/workflows/build.yml | 20 +------------------- .github/workflows/cache-warmup.yaml | 9 +++++++++ .github/workflows/stack-test.yml | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/cache-warmup.yaml create mode 100644 .github/workflows/stack-test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd14fd6..84332c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,25 +9,7 @@ concurrency: cancel-in-progress: true jobs: stack-test: - name: stack test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: haskell/ghcup-setup@v1 - id: ghcup - with: - stack-hook: true - - uses: actions/cache@v4 - with: - path: | - ${{ steps.ghcup.outputs.basedir }} - ~/.stack - key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml') }} - restore-keys: | - stack-${{ runner.os }}- - ${{ runner.os }}- - - run: ghcup install stack - - run: stack test + uses: ./.github/workflows/stack-test.yml flake-no-push: name: flake check (no push) diff --git a/.github/workflows/cache-warmup.yaml b/.github/workflows/cache-warmup.yaml new file mode 100644 index 0000000..625cba4 --- /dev/null +++ b/.github/workflows/cache-warmup.yaml @@ -0,0 +1,9 @@ +name: biweekly cache warmup +on: + schedule: + # Every Monday and Thursday at 11:23 UTC + - cron: '23 11 * * mon,thu' + workflow_dispatch: +jobs: + stack-test: + uses: ./.github/workflows/stack-test.yml diff --git a/.github/workflows/stack-test.yml b/.github/workflows/stack-test.yml new file mode 100644 index 0000000..bab0438 --- /dev/null +++ b/.github/workflows/stack-test.yml @@ -0,0 +1,25 @@ +# Reusable workflow used by the others. Not called directly usually. +name: stack test +on: + workflow_call: +jobs: + stack-test: + name: stack test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: haskell/ghcup-setup@v1 + id: ghcup + with: + stack-hook: true + - uses: actions/cache@v4 + with: + path: | + ${{ steps.ghcup.outputs.basedir }} + ~/.stack + key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml') }} + restore-keys: | + stack-${{ runner.os }}- + ${{ runner.os }}- + - run: ghcup install stack + - run: stack test From 536f0311cfbcdd8cf30b26a0b92bf3f6ac72aab2 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Mon, 13 Apr 2026 09:37:16 +0300 Subject: [PATCH 2/4] Clean up unneeded flake-check duplication The cachix action already only pushes from protected branches, based on the presence of the auth token. --- .github/workflows/build.yml | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84332c8..e702717 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,5 @@ -name: check and push +# CI that runs on pull requests and pushes to master. +name: CI on: push: branches: @@ -11,29 +12,14 @@ jobs: stack-test: uses: ./.github/workflows/stack-test.yml - flake-no-push: - name: flake check (no push) - if: github.event_name != 'push' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v31 - - uses: cachix/cachix-action@v15 - with: - name: stackage-infrastructure - - run: nix build - - run: nix flake check - - flake-push: + flake-check: name: flake check and push if: github.event_name == 'push' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: cachix/install-nix-action@v31 - - uses: cachix/cachix-action@v15 - with: - name: stackage-infrastructure - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - uses: DeterminateSystems/magic-nix-cache-action@v13 + - uses: cachix/cachix-action@v17 - run: nix build - run: nix flake check From a4e934b5e2e8931cb092e0f95a6318e2c0928950 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Mon, 13 Apr 2026 09:39:15 +0300 Subject: [PATCH 3/4] Automate action updates --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ca79ca5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly From 29cee69f8a435056170313f22e2221fa80173f67 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Mon, 13 Apr 2026 10:20:48 +0300 Subject: [PATCH 4/4] Make the reusable workflow a reusable action --- .github/actions/stack-test/action.yml | 22 ++++++++++++++++++++++ .github/workflows/build.yml | 6 +++++- .github/workflows/cache-warmup.yaml | 6 +++++- .github/workflows/stack-test.yml | 25 ------------------------- 4 files changed, 32 insertions(+), 27 deletions(-) create mode 100644 .github/actions/stack-test/action.yml delete mode 100644 .github/workflows/stack-test.yml diff --git a/.github/actions/stack-test/action.yml b/.github/actions/stack-test/action.yml new file mode 100644 index 0000000..bc6e650 --- /dev/null +++ b/.github/actions/stack-test/action.yml @@ -0,0 +1,22 @@ +name: stack test +description: Build and test with stack +runs: + using: composite + steps: + - uses: haskell/ghcup-setup@v1 + id: ghcup + with: + stack-hook: true + - uses: actions/cache@v4 + with: + path: | + ${{ steps.ghcup.outputs.basedir }} + ~/.stack + key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml') }} + restore-keys: | + stack-${{ runner.os }}- + ${{ runner.os }}- + - run: ghcup install stack + shell: bash + - run: stack test + shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e702717..11d6768 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,11 @@ concurrency: cancel-in-progress: true jobs: stack-test: - uses: ./.github/workflows/stack-test.yml + name: stack test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: ./.github/actions/stack-test flake-check: name: flake check and push diff --git a/.github/workflows/cache-warmup.yaml b/.github/workflows/cache-warmup.yaml index 625cba4..88b7607 100644 --- a/.github/workflows/cache-warmup.yaml +++ b/.github/workflows/cache-warmup.yaml @@ -6,4 +6,8 @@ on: workflow_dispatch: jobs: stack-test: - uses: ./.github/workflows/stack-test.yml + name: stack test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: ./.github/actions/stack-test diff --git a/.github/workflows/stack-test.yml b/.github/workflows/stack-test.yml deleted file mode 100644 index bab0438..0000000 --- a/.github/workflows/stack-test.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Reusable workflow used by the others. Not called directly usually. -name: stack test -on: - workflow_call: -jobs: - stack-test: - name: stack test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: haskell/ghcup-setup@v1 - id: ghcup - with: - stack-hook: true - - uses: actions/cache@v4 - with: - path: | - ${{ steps.ghcup.outputs.basedir }} - ~/.stack - key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml') }} - restore-keys: | - stack-${{ runner.os }}- - ${{ runner.os }}- - - run: ghcup install stack - - run: stack test