ci: Custom GitHub Runners for Nix Builds #3640
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: Nix CI | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - release/* | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| # required by dependent workflows | |
| contents: write | |
| packages: write | |
| jobs: | |
| extensions-matrix: | |
| runs-on: | |
| group: self-hosted-runners-nix | |
| labels: | |
| - aarch64-darwin | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - id: set-matrix | |
| name: Generate Nix Matrix | |
| run: | | |
| set -Eeu | |
| echo matrix="$(python scripts/github-matrix.py extensions)" >> "$GITHUB_OUTPUT" | |
| build-extensions-aarch64-linux: | |
| name: ${{matrix.postgresql_version}}.${{ matrix.name }} (aarch64-linux) | |
| needs: extensions-matrix | |
| runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} | |
| if: ${{ fromJSON(needs.extensions-matrix.outputs.matrix).aarch64_linux != null }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 5 | |
| matrix: ${{ fromJSON(needs.extensions-matrix.outputs.matrix).aarch64_linux }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Build Nix Package | |
| uses: ./.github/actions/nix-build-setup | |
| with: | |
| attr: ${{ matrix.attr }} | |
| build-extensions-aarch64-darwin: | |
| name: ${{matrix.postgresql_version}}.${{ matrix.name }} (aarch64-darwin) | |
| needs: extensions-matrix | |
| runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} | |
| if: ${{ fromJSON(needs.extensions-matrix.outputs.matrix).aarch64_darwin != null }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 5 | |
| matrix: ${{ fromJSON(needs.extensions-matrix.outputs.matrix).aarch64_darwin }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Build Nix Package | |
| uses: ./.github/actions/nix-build-setup | |
| with: | |
| attr: ${{ matrix.attr }} | |
| # TODO | |
| # build-extensions-x86_64-linux: | |
| # name: ${{matrix.postgresql_version}}.${{ matrix.name }} (x86_64-linux) | |
| # needs: extensions-matrix | |
| # runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} | |
| # if: ${{ fromJSON(needs.extensions-matrix.outputs.matrix).x86_64_linux != null }} | |
| # strategy: | |
| # fail-fast: false | |
| # max-parallel: 3 | |
| # matrix: ${{ fromJSON(needs.extensions-matrix.outputs.matrix).x86_64_linux }} | |
| # steps: | |
| # - name: Checkout Repo | |
| # uses: actions/checkout@v4 | |
| # - name: Build Nix Package | |
| # uses: ./.github/actions/nix-build-setup | |
| # with: | |
| # attr: ${{ matrix.attr }} | |
| checks-matrix: | |
| needs: [build-extensions-aarch64-linux, build-extensions-aarch64-darwin] #, build-extensions-x86_64-linux] | |
| if: | | |
| !cancelled() && | |
| (needs.build-extensions-aarch64-linux.result == 'skipped' || needs.build-extensions-aarch64-linux.result == 'success') && | |
| (needs.build-extensions-aarch64-darwin.result == 'skipped' || needs.build-extensions-aarch64-darwin.result == 'success') | |
| runs-on: | |
| group: self-hosted-runners-nix | |
| labels: | |
| - aarch64-darwin | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - id: set-matrix | |
| name: Generate Nix Matrix | |
| run: | | |
| set -Eeu | |
| echo matrix="$(python scripts/github-matrix.py checks)" >> "$GITHUB_OUTPUT" | |
| build-checks-aarch64-linux: | |
| name: ${{ matrix.name }} (aarch64-linux) | |
| needs: checks-matrix | |
| runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} | |
| if: ${{ fromJSON(needs.checks-matrix.outputs.matrix).aarch64_linux != null }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 5 | |
| matrix: ${{ fromJSON(needs.checks-matrix.outputs.matrix).aarch64_linux }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Build Nix Package | |
| uses: ./.github/actions/nix-build-setup | |
| with: | |
| attr: ${{ matrix.attr }} | |
| build-checks-aarch64-darwin: | |
| name: ${{ matrix.name }} (aarch64-darwin) | |
| needs: checks-matrix | |
| runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} | |
| if: ${{ fromJSON(needs.checks-matrix.outputs.matrix).aarch64_darwin != null }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 5 | |
| matrix: ${{ fromJSON(needs.checks-matrix.outputs.matrix).aarch64_darwin }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Build Nix Package | |
| uses: ./.github/actions/nix-build-setup | |
| with: | |
| attr: ${{ matrix.attr }} | |
| # TODO | |
| # build-checks-x86_64-linux: | |
| # name: ${{matrix.postgresql_version}}.${{ matrix.name }} (x86_64-linux) | |
| # needs: checks-matrix | |
| # runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }} | |
| # if: ${{ fromJSON(needs.checks-matrix.outputs.matrix).x86_64_linux != null }} | |
| # strategy: | |
| # fail-fast: false | |
| # max-parallel: 5 | |
| # matrix: ${{ fromJSON(needs.checks-matrix.outputs.matrix).x86_64_linux }} | |
| # steps: | |
| # - name: Checkout Repo | |
| # uses: actions/checkout@v4 | |
| # - name: Build Nix Package | |
| # uses: ./.github/actions/nix-build-setup | |
| # with: | |
| # attr: ${{ matrix.attr }} | |
| run-tests: | |
| needs: [build-checks-aarch64-linux, build-checks-aarch64-darwin] #, build-checks-x86_64-linux] | |
| if: | | |
| !cancelled() && | |
| (needs.build-checks-aarch64-linux.result == 'skipped' || needs.build-checks-aarch64-linux.result == 'success') && | |
| (needs.build-checks-aarch64-darwin.result == 'skipped' || needs.build-checks-aarch64-darwin.result == 'success') | |
| uses: ./.github/workflows/test.yml |