mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-26 18:24:53 +00:00
112 lines
3.9 KiB
YAML
112 lines
3.9 KiB
YAML
name: Build
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
artifact-prefix:
|
|
required: true
|
|
type: string
|
|
baseBranch:
|
|
required: true
|
|
type: string
|
|
mergedSha:
|
|
required: true
|
|
type: string
|
|
targetSha:
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
# Should only be provided in the merge queue, not in pull requests,
|
|
# where we're evaluating untrusted code.
|
|
CACHIX_AUTH_TOKEN_GHA:
|
|
required: false
|
|
|
|
permissions: {}
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runner: ubuntu-24.04
|
|
system: x86_64-linux
|
|
builds: [shell, manual-nixos, lib-tests, tarball]
|
|
desc: shell, docs, lib, tarball
|
|
- runner: ubuntu-24.04-arm
|
|
system: aarch64-linux
|
|
builds: [shell, manual-nixos, manual-nixpkgs]
|
|
desc: shell, docs
|
|
- runner: macos-14
|
|
system: aarch64-darwin
|
|
builds: [shell]
|
|
desc: shell
|
|
name: '${{ matrix.system }}: ${{ matrix.desc }}'
|
|
runs-on: ${{ matrix.runner }}
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
sparse-checkout: .github/actions
|
|
- name: Checkout the merge commit
|
|
uses: ./.github/actions/checkout
|
|
with:
|
|
merged-as-untrusted-at: ${{ inputs.mergedSha }}
|
|
target-as-trusted-at: ${{ inputs.targetSha }}
|
|
|
|
- uses: cachix/install-nix-action@630ae543ea3a38a9a4166f03376c02c50f408342 # v31.11.0
|
|
with:
|
|
# Sandbox is disabled on MacOS by default.
|
|
extra_nix_config: sandbox = true
|
|
|
|
- uses: cachix/cachix-action@5f2d7c5294214f71b873db4b969586b980625e71 # v17
|
|
continue-on-error: true
|
|
with:
|
|
# The nixpkgs-gha cache should not be trusted or used outside of Nixpkgs and its forks' CI.
|
|
name: ${{ vars.CACHIX_NAME || 'nixpkgs-gha' }}
|
|
extraPullNames: nixpkgs-gha
|
|
authToken: ${{ secrets.CACHIX_AUTH_TOKEN_GHA }}
|
|
pushFilter: '(-source$|-nixpkgs-tarball-)'
|
|
|
|
- run: nix-env --install -f nixpkgs/trusted-pinned -A nix-build-uncached
|
|
|
|
- name: Build shell
|
|
if: contains(matrix.builds, 'shell')
|
|
env:
|
|
system: ${{ matrix.system }}
|
|
run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A shell --argstr system "$system"
|
|
|
|
- name: Build NixOS manual
|
|
if: |
|
|
contains(matrix.builds, 'manual-nixos') && !cancelled() &&
|
|
(contains(fromJSON(inputs.baseBranch).type, 'primary')
|
|
|| startsWith(fromJSON(inputs.baseBranch).branch, 'staging-nixos')
|
|
)
|
|
run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A manual-nixos --out-link nixos-manual
|
|
|
|
- name: Build Nixpkgs manual
|
|
if: contains(matrix.builds, 'manual-nixpkgs') && !cancelled()
|
|
run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A manual-nixpkgs
|
|
|
|
- name: Build lib tests
|
|
if: contains(matrix.builds, 'lib-tests') && !cancelled()
|
|
run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A lib-tests
|
|
|
|
- name: Build tarball
|
|
if: contains(matrix.builds, 'tarball') && !cancelled()
|
|
run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A tarball
|
|
|
|
- name: Upload NixOS manual
|
|
if: |
|
|
contains(matrix.builds, 'manual-nixos') && !cancelled() &&
|
|
contains(fromJSON(inputs.baseBranch).type, 'primary')
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: ${{ inputs.artifact-prefix }}nixos-manual-${{ matrix.system }}
|
|
path: nixos-manual
|