Fix concurrency in build action #18
This file contains 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: nix build | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
define-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
hosts: ${{ steps.flake-show.outputs.hosts }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
- name: Define hosts | |
id: flake-show | |
run: | | |
hosts=`nix flake show --json | jq '.nixosConfigurations | keys[]' | paste -sd, -` | |
echo "hosts=[$hosts]" >> $GITHUB_OUTPUT | |
build: | |
runs-on: ubuntu-latest | |
needs: define-matrix | |
strategy: | |
matrix: | |
host: ${{ fromJSON(needs.define-matrix.outputs.hosts) }} | |
concurrency: | |
# Cancel any in-progress workflow runs from the same PR or branch | |
group: ${{ github.workflow }}.${{ github.event.pull_request.number || github.ref }}.${{ matrix.host }} | |
cancel-in-progress: true | |
steps: | |
- uses: jlumbroso/free-disk-space@main | |
with: | |
large-packages: false | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
extra_nix_config: | | |
trusted-public-keys = nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
substituters = https://nix-gaming.cachix.org https://cache.nixos.org | |
connect-timeout = 5 | |
system-features = nixos-test benchmark big-parallel kvm | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: joinemm | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- name: Build ${{ matrix.host }} | |
env: | |
host: ${{ matrix.host }} | |
run: | | |
nix build .#nixosConfigurations.$host.config.system.build.toplevel |