diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..577c30c4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,51 @@ +name: Build + +on: + workflow_call: + inputs: + name: + required: true + type: string + system: + required: true + type: string + os: + required: true + type: string + attr: + required: true + type: string + timeout: + required: false + type: number + default: 60 + +jobs: + build: + name: ${{ inputs.name }} + runs-on: ${{ inputs.os }} + timeout-minutes: ${{ inputs.timeout }} + steps: + - name: Free disk space + if: endsWith( '-linux', inputs.system ) + uses: wimpysworld/nothing-but-nix@main + with: + # Options: holster, carve, cleave (default), rampage + hatchet-protocol: rampage + - name: Checkout + uses: actions/checkout@v4 + - name: Install nix + uses: cachix/install-nix-action@v31 + - name: Setup nix cache + uses: cachix/cachix-action@v16 + with: + name: nix-community + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + - name: Build ${{ inputs.attr }} + env: + attr: ${{ inputs.attr }} + run: | + nix build ".#$attr" \ + --abort-on-warn \ + --print-build-logs \ + --log-format raw diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 97e14e35..0024b38b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -14,7 +14,7 @@ on: - "LICENSE" jobs: - build-matrix: + prepare: runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} @@ -31,35 +31,14 @@ jobs: echo "matrix=$matrix" >> "$GITHUB_OUTPUT" build: - name: ${{ matrix.name }} (${{ matrix.system }}) + uses: ./.github/workflows/build.yml needs: - - build-matrix - runs-on: ${{ matrix.os }} + - prepare strategy: fail-fast: false - matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }} - timeout-minutes: 20 - steps: - - name: Free disk space - if: endsWith( '-linux', matrix.system ) - uses: wimpysworld/nothing-but-nix@main - with: - # Options: holster, carve, cleave (default), rampage - hatchet-protocol: rampage - - name: Checkout - uses: actions/checkout@v4 - - name: Install nix - uses: cachix/install-nix-action@v31 - - name: Setup nix cache - uses: cachix/cachix-action@v16 - with: - name: nix-community - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - name: Build ${{ matrix.attr }} - env: - attr: ${{ matrix.attr }} - run: | - nix build ".#$attr" \ - --abort-on-warn \ - --print-build-logs \ - --log-format raw + matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} + with: + name: ${{ matrix.name }} (${{ matrix.system }}) + system: ${{ matrix.system }} + os: ${{ matrix.os }} + attr: ${{ matrix.attr }}