Merge pull request #114 from DeterminateSystems/nix-formatting #335
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: Build and Publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - labeled | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| checks: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: DeterminateSystems/determinate-nix-action@main | |
| - uses: DeterminateSystems/flakehub-cache-action@main | |
| - name: Check Nix formatting | |
| run: git ls-files '*.nix' | nix develop --command xargs nixfmt --check | |
| - name: Check external links in README | |
| run: nix develop --command check-readme-links | |
| verify-outputs: | |
| strategy: | |
| matrix: | |
| runners: | |
| - { system: aarch64-darwin, runner: macos-latest-xlarge } | |
| - { system: x86_64-darwin, runner: macos-latest-xlarge } | |
| - { system: aarch64-linux, runner: UbuntuLatest32Cores128GArm } | |
| - { system: x86_64-linux, runner: UbuntuLatest32Cores128G } | |
| runs-on: ${{ matrix.runners.runner }} | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: DeterminateSystems/determinate-nix-action@main | |
| - uses: DeterminateSystems/flakehub-cache-action@main | |
| - run: nix build .#packages."$SYSTEM".default | |
| env: | |
| SYSTEM: ${{ matrix.runners.system }} | |
| test-modules: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: DeterminateSystems/determinate-nix-action@main | |
| - uses: DeterminateSystems/flakehub-cache-action@main | |
| - run: | | |
| set -eux | |
| cd tests | |
| rm -f flake.lock | |
| nix flake lock | |
| nix flake check | |
| - run: | | |
| set -eux | |
| nix flake lock | |
| git diff --exit-code | |
| success: | |
| needs: [checks, verify-outputs, test-modules] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: true | |
| publish: | |
| if: (!github.repository.fork && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))) | |
| environment: ${{ github.event_name == 'release' && 'production' || '' }} | |
| needs: [success] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: DeterminateSystems/determinate-nix-action@main | |
| - uses: DeterminateSystems/flakehub-push@main | |
| with: | |
| rolling: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
| visibility: unlisted | |
| tag: ${{ github.ref_name }} |