WIP: ci: check every commit #27
2 changed files with 39 additions and 5 deletions
8
.forgejo/workflows/check-since.sh
Executable file
8
.forgejo/workflows/check-since.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
git rev-list "$1"..HEAD | while read -r ref; do
|
||||
git switch "$ref"
|
||||
nix flake check --accept-flake-config
|
||||
done
|
|
@ -11,14 +11,40 @@ jobs:
|
|||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://github.com/docker/setup-qemu-action@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: https://github.com/cachix/install-nix-action@v26
|
||||
- name: Checkout
|
||||
run: |
|
||||
set -x
|
||||
git init /workspace/kitchen/rice
|
||||
cd /workspace/kitchen/rice
|
||||
git remote add origin ${{ env.GITHUB_SERVER_URL }}/${{ env.GITHUB_REPOSITORY }}
|
||||
if [[ ${{ github.event_name }} == pull_request ]]; then
|
||||
ref="refs/remotes/pull/${{ github.event.pull_request.number }}/head"
|
||||
else
|
||||
ref="refs/remotes/${{ github.event.base_ref }}"
|
||||
fi
|
||||
git fetch origin :"$ref"
|
||||
git switch --detach "$ref"
|
||||
- name: Setup qemu
|
||||
uses: https://github.com/docker/setup-qemu-action@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install nix
|
||||
uses: https://github.com/cachix/install-nix-action@v26
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
github_access_token: '${{ secrets.GH_TOKEN }}'
|
||||
- uses: https://github.com/cachix/cachix-action@v14
|
||||
- name: Setup cachix
|
||||
uses: https://github.com/cachix/cachix-action@v14
|
||||
with:
|
||||
name: kitchen
|
||||
authToken: '${{ secrets.CACHIX_TOKEN }}'
|
||||
- run: nix flake check --accept-flake-config
|
||||
- name: Run tests
|
||||
run: |
|
||||
set -x
|
||||
if [[ ${{ github.event_name }} == push ]]; then
|
||||
ref="HEAD~$(echo "${{ toJSON(github.event.commits) }}" | nix run nixpkgs#jq length)"
|
||||
else
|
||||
ref="${{ github.event.base_ref }}"
|
||||
fi
|
||||
"$PWD"/.forgejo/workflows/check-since.sh "$ref"
|
||||
|
|
Loading…
Reference in a new issue