Skip to content

Move the actual vm tests / flake regressions into the generic build p… #2

Move the actual vm tests / flake regressions into the generic build p…

Move the actual vm tests / flake regressions into the generic build p… #2

Workflow file for this run

on:
workflow_call:
inputs:
system:
required: true
type: string
runner:
default: |
${{
(system == "x86_64-linux" && "blacksmith-32vcpu-ubuntu-2204")
|| (system == "aarch64-linux" && "blacksmith-32vcpu-ubuntu-2204-arm")
|| (system == "x86_64-darwin" && "macos-latest-large")
|| (system == "aarch64-darwin" && "macos-latest-xlarge")
|| "unknown-system"
}}
required: true
type: string
runner_small:
default: |
${{
(system == "x86_64-linux" && "ubuntu-latest")
|| (system == "aarch64-linux" && "blacksmith-32vcpu-ubuntu-2204-arm")
|| (system == "x86_64-darwin" && "macos-latest-large")
|| (system == "aarch64-darwin" && "macos-latest-xlarge")
|| "unknown-system"
}}
required: true
type: string
if:
required: false
default: true
type: boolean
run_tests:
required: false
default: true
type: boolean
run_vm_tests:
required: false
default: false
type: boolean
run_regression_tests:
required: false
default: false
type: boolean
jobs:
build:
if: ${{ inputs.if }}
strategy:
fail-fast: false
runs-on: ${{ inputs.runner }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- run: nix build .#packages.${{ inputs.system }}.default .#packages.${{ inputs.system }}.binaryTarball --no-link -L
- run: nix build .#packages.${{ inputs.system }}.binaryTarball --out-link tarball
- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.system }}
path: ./tarball/*.xz
test:
if: ${{ inputs.if && inputs.run_tests}}
needs: build
strategy:
fail-fast: false
runs-on: ${{ inputs.runner }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- run: nix flake check -L --system ${{ inputs.system }}
vm_tests_smoke:
if: inputs.run_vm_tests && github.event_name != 'merge_group'
needs: build
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- run: |
nix build -L \
.#hydraJobs.tests.functional_user \
.#hydraJobs.tests.githubFlakes \
.#hydraJobs.tests.nix-docker \
.#hydraJobs.tests.tarballFlakes \
;
vm_tests_all:
if: inputs.run_vm_tests && github.event_name == 'merge_group'
needs: build
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- run: |
nix build -L --keep-going \
$(nix flake show --json \
| jq -r '
.hydraJobs.tests
| with_entries(select(.value.type == "derivation"))
| keys[]
| ".#hydraJobs.tests." + .')
flake_regressions:
if: |
(inputs.run_regression_tests && github.event_name == 'merge_group')
|| (
github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-src'
&& (
(github.event.action == 'labeled' && github.event.label.name == 'flake-regression-test')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'flake-regression-test'))
)
)
needs: build
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout nix
uses: actions/checkout@v4
- name: Checkout flake-regressions
uses: actions/checkout@v4
with:
repository: DeterminateSystems/flake-regressions
path: flake-regressions
- name: Checkout flake-regressions-data
uses: actions/checkout@v4
with:
repository: DeterminateSystems/flake-regressions-data
path: flake-regressions/tests
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH PARALLEL="-P 50%" flake-regressions/eval-all.sh
flake_regressions_lazy:
if: |
(inputs.run_regression_tests && github.event_name == 'merge_group')
|| (
github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-src'
&& (
(github.event.action == 'labeled' && github.event.label.name == 'flake-regression-test')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'flake-regression-test'))
)
)
needs: build
runs-on: ${{ inputs.run_regression_tests }}
steps:
- name: Checkout nix
uses: actions/checkout@v4
- name: Checkout flake-regressions
uses: actions/checkout@v4
with:
repository: DeterminateSystems/flake-regressions
path: flake-regressions
- name: Checkout flake-regressions-data
uses: actions/checkout@v4
with:
repository: DeterminateSystems/flake-regressions-data
path: flake-regressions/tests
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH PARALLEL="-P 50%" NIX_CONFIG="lazy-trees = true" flake-regressions/eval-all.sh
manual:
if: github.event_name != 'merge_group'
needs: build
runs-on: ${{ inputs.runner_small }}
permissions:
id-token: "write"
contents: "read"
pull-requests: "write"
statuses: "write"
deployments: "write"
steps:
- name: Checkout nix
uses: actions/checkout@v4
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Build manual
run: nix build .#hydraJobs.manual
- uses: nwtgck/[email protected]
with:
publish-dir: "./result/share/doc/nix/manual"
production-branch: detsys-main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
# NOTE(cole-h): We have a perpetual PR displaying our changes against upstream open, but
# its conversation is locked, so this PR comment can never be posted.
# https://github.com/DeterminateSystems/nix-src/pull/4
enable-pull-request-comment: ${{ github.event.pull_request.number != 4 }}
enable-commit-comment: true
enable-commit-status: true
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
success:
needs:
- build
- test
- vm_tests_smoke
- vm_tests_all
- flake_regressions
- flake_regressions_lazy
- manual
if: ${{ always() }}
steps:

Check failure on line 210 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yml

Invalid workflow file

You have an error in your yaml syntax on line 210
- run: "true"
- run: |
echo "A dependent in the build matrix failed:"
echo "$needs"
exit 1
env:
needs: ${{ toJSON(needs) }}
if: |
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')