Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/nix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Install Nix
description: Install Nix and trust the flake's own nixConfig, which names the nix.moq.dev cache.

runs:
using: composite
steps:
# Nix ignores a flake's `nixConfig` unless told to accept it, and would then
# rebuild from source everything nixpkgs doesn't serve: ~12 minutes of
# uniffi-bindgen-go alone in every job that enters the dev shell. Accepting
# it keeps flake.nix the only place that names the cache and its key. The
# flake is this checkout, which these jobs already run as code.
- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
extra-conf: |
accept-flake-config = true
4 changes: 1 addition & 3 deletions .github/actions/setup-packaging/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ description: Install Nix and prepend the .#packaging output bin/ to $PATH.
runs:
using: composite
steps:
- uses: DeterminateSystems/nix-installer-action@00199f951aeb9404028a6e4b95ad42546f73296a # main
with:
determinate: false
- uses: ./.github/actions/nix

- name: Build packaging tools from flake
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/alert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:
# `just gh check` enforces coverage and the exclusions in alert.sh.
workflows:
- apt-repo
- Cachix
- Docker
- Interop
- moq-c
Expand All @@ -32,6 +31,7 @@ on:
- Release JS
- Release Kotlin FFI
- Release Kotlin lib
- Release Nix
- Release Py
- Release Py FFI
- Release RS
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/audio-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ jobs:
with:
persist-credentials: false

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter; see check.yml.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix

- name: Replay
run: nix develop --command just test audio-quality --replays --enforce
Expand Down
42 changes: 17 additions & 25 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Cache

# Pushes the dev shell closure that every nix job substitutes.
# Pushes the dev shell closure that every nix job substitutes from nix.moq.dev.
#
# The Nix signing key and the CI bucket's write key live in the `cache-write`
# Environment, which pull requests cannot deploy to (see infra/README.md).
#
# The Rust build cache is not warmed here: `main` and its merge queue publish
# what they compile as they run (see .github/actions/rust-cache).
Expand All @@ -15,6 +18,7 @@ on:
paths:
- "flake.nix"
- "flake.lock"
# Patches and lockfiles the dev shell builds from.
- "nix/**"
- ".github/workflows/cache.yml"
# Priming the shell by hand, e.g. after a failed push.
Expand All @@ -35,41 +39,29 @@ jobs:
runner: [ubuntu-24.04-arm, ubuntu-latest]
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
environment: cache-write

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter. `nixConfig` in flake.nix is
# untrusted by default, so nix logs "ignoring untrusted flake
# configuration setting 'extra-substituters'" and rebuilds from
# source anything missing from the public nixpkgs cache. That was
# costing 678s per job for uniffi-bindgen-go alone, in every job that
# enters the dev shell.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=

# cachix.yml only fires on release tags and only pushes the tagged
# package, so the dev shell itself was never cached. Anything in it that
# nixpkgs doesn't serve prebuilt (uniffi-bindgen-go, a
# buildRustPackage from a git tag) was therefore compiled from source by
# every job that entered the shell. Push it once here so later jobs
# substitute it instead.
- uses: cachix/cachix-action@38b082610b782e7e93e209c35fd730d399dee866 # v17
with:
name: kixelated
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- uses: ./.github/actions/nix

# Anything in the dev shell that nixpkgs doesn't serve prebuilt
# (uniffi-bindgen-go, a buildRustPackage from a git tag) would otherwise
# compile from source in every job that enters it. Only paths missing
# from the bucket upload, so this also restores whatever its lifecycle
# rule expired.
- name: Cache the dev shell
env:
NIX_SIGNING_KEY: ${{ secrets.NIX_SIGNING_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.NIX_R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.NIX_R2_SECRET_ACCESS_KEY }}
run: |
# `--profile` realises the shell's full build closure, which is what
# the runners actually need; `nix build .#devShells...` alone leaves
# out the build-time inputs.
nix develop --profile /tmp/devshell --command true
cachix push kixelated /tmp/devshell
nix develop --command just infra nix push nix-ci-moq-dev /tmp/devshell
26 changes: 2 additions & 24 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,8 @@ jobs:
env:
CI_BASE: ${{ github.base_ref == 'release' && '--all' || github.event.merge_group.base_sha }}

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
- uses: ./.github/actions/nix
if: steps.scope.outputs.needed == 'true'
with:
determinate: false
# Trust the flake's cachix substituter. `nixConfig` in flake.nix is
# untrusted by default, so nix logs "ignoring untrusted flake
# configuration setting 'extra-substituters'" and rebuilds from
# source anything missing from the public nixpkgs cache. That was
# costing 678s per job for uniffi-bindgen-go alone, in every job that
# enters the dev shell.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: DeterminateSystems/flake-checker-action@786422608c7bded2bbc9741ad9f91356842bf520 # main
if: steps.scope.outputs.needed == 'true'

Expand Down Expand Up @@ -122,19 +111,8 @@ jobs:
env:
CI_BASE: ${{ github.base_ref == 'release' && '--all' || github.event.merge_group.base_sha }}

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
- uses: ./.github/actions/nix
if: steps.scope.outputs.needed == 'true'
with:
determinate: false
# Trust the flake's cachix substituter. `nixConfig` in flake.nix is
# untrusted by default, so nix logs "ignoring untrusted flake
# configuration setting 'extra-substituters'" and rebuilds from
# source anything missing from the public nixpkgs cache. That was
# costing 678s per job for uniffi-bindgen-go alone, in every job that
# enters the dev shell.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=

# Reads and writes like the `check` job above.
- name: Rust cache
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,7 @@ jobs:
with:
persist-credentials: false

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter. `nixConfig` in flake.nix is
# untrusted by default, so nix logs "ignoring untrusted flake
# configuration setting 'extra-substituters'" and rebuilds from
# source anything missing from the public nixpkgs cache. That was
# costing 678s per job for uniffi-bindgen-go alone, in every job that
# enters the dev shell.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix

# The relay, cli, moq-ffi, and moq-c all build from source. The nightly
# run publishes them for the pull requests that touch the harness.
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/moq-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@ jobs:

- name: Install Nix
if: matrix.use_nix
uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, as check.yml does, so the dev
# shell is substituted rather than built from source.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
uses: ./.github/actions/nix

- name: Install Rust (Windows)
if: '!matrix.use_nix'
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/moq-gst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ jobs:

- uses: ./.github/actions/just

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, as check.yml does, so the dev
# shell is substituted rather than built from source.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix

- name: Parse version
id: parse
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/moq-sh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,7 @@ jobs:
with:
persist-credentials: false

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, as check.yml does, so the dev
# shell is substituted rather than built from source.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix

- name: Deploy
env:
Expand Down
52 changes: 7 additions & 45 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,7 @@ jobs:
with:
persist-credentials: false

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, as check.yml does, so the dev
# shell is substituted rather than built from source.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix

# Writes from `main`, like every Rust cache user there.
- name: Rust cache
Expand Down Expand Up @@ -252,9 +245,7 @@ jobs:
with:
# Only this main-branch publisher pushes the shared history branch.
persist-credentials: true
- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
- uses: ./.github/actions/nix
# No dev shell: these recipes need only just, the runner's python3 and git.
# Building the shell's uncached tools outlasted this job's timeout.
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
Expand Down Expand Up @@ -334,14 +325,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, as check.yml does, so the dev
# shell is substituted rather than built from source.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix
- name: Rust cache
uses: ./.github/actions/rust-cache
with:
Expand Down Expand Up @@ -375,12 +359,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix
- name: Rust cache
uses: ./.github/actions/rust-cache
with:
Expand Down Expand Up @@ -426,12 +405,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix
- name: Rust cache
uses: ./.github/actions/rust-cache
with:
Expand Down Expand Up @@ -603,12 +577,7 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix
- uses: ./.github/actions/rust-cache
with:
access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -645,14 +614,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, as check.yml does, so the dev
# shell is substituted rather than built from source.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/obs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,7 @@ jobs:
with:
persist-credentials: false

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, so the dev shell substitutes
# instead of building from source. See check.yml for the full story.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix

# Read only: this runs for `release` alone, and Nightly's `obs ci` row
# writes on `main`. The cache holds dev-profile artifacts, which is why
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/quest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@ jobs:
with:
persist-credentials: false

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, which holds the quest build
# as part of the dev shell closure; see check.yml.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix

# The whole tree, unscoped: a push has no base to diff against.
#
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,7 @@ jobs:

- uses: ./.github/actions/just

- uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
# Trust the flake's cachix substituter, as check.yml does, so the dev
# shell is substituted rather than built from source.
extra-conf: |
extra-substituters = https://kixelated.cachix.org
extra-trusted-public-keys = kixelated.cachix.org-1:CmFcV0lyM6KuVM2m9mih0q4SrAa0XyCsiM7GHrz3KKk=
- uses: ./.github/actions/nix

- name: Parse version
id: parse
Expand Down
Loading