CI #142
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: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: "27 2 */3 * *" # run every three days at 2:27 am | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| nixfmt: | |
| name: nixfmt | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21 | |
| - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13 | |
| with: | |
| use-flakehub: false | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: nixfmt | |
| run: nix run nixpkgs#nixfmt-rfc-style -- --check . | |
| deadnix: | |
| name: deadnix | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21 | |
| - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13 | |
| with: | |
| use-flakehub: false | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: deadnix | |
| run: nix run nixpkgs#deadnix -- --fail . | |
| show: | |
| name: nix flake show | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| matrix: ${{ steps.generate-matrix.outputs.matrix }} | |
| steps: | |
| - uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21 | |
| - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13 | |
| with: | |
| use-flakehub: false | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: Show flake structure | |
| run: nix flake show 2> /dev/null | |
| - name: Generate test matrix | |
| id: generate-matrix | |
| run: | | |
| matrix=$(nix flake show --json | jq -r '.checks["x86_64-linux"] | keys | tojson') | |
| echo "matrix=${matrix}" >> $GITHUB_OUTPUT | |
| check: | |
| name: nix flake check | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21 | |
| - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13 | |
| with: | |
| use-flakehub: false | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: Check flake | |
| run: nix -L flake check --no-build | |
| test: | |
| name: "nix build .#${{ matrix.name }}" | |
| needs: [ show, check ] | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| name: ${{ fromJson(needs.show.outputs.matrix) }} | |
| steps: | |
| - name: Maximize build space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| - uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21 | |
| - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13 | |
| with: | |
| use-flakehub: false | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: Run integration test | |
| run: nix -L build .#checks.x86_64-linux.${{ matrix.name }} |