How about a CI API call reduction? (#245)

* How about a CI API call reduction?

* Not everyone uses Nix with flakes, turns out we are one of them

* Unbreak GHA file

* Purge github actifacts use

* Missed one.

* chmod right path

* chmod right binary name

* Fix steam deck, mac still broken due to containers

* Attempt to use github cache instead of the buildkite action

* See if we get the right artifacts

* Skip a test that Macs dislike

* Write GHA file correctly

* Refine jobs on buildkite and pathes on gha

* Better output

* Even more output!

* Use correct folder structure
This commit is contained in:
Ana Hobden 2023-02-14 08:27:40 -08:00 committed by GitHub
parent 1c0c92f35e
commit 6ec5080a2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 102 deletions

View file

@ -25,6 +25,14 @@ steps:
- nix --extra-experimental-features "nix-command flakes" build .#packages.x86_64-linux.nix-installer-static -L - nix --extra-experimental-features "nix-command flakes" build .#packages.x86_64-linux.nix-installer-static -L
- cp result/bin/nix-installer ./nix-installer-x86_64-linux - cp result/bin/nix-installer ./nix-installer-x86_64-linux
- buildkite-agent artifact upload nix-installer-x86_64-linux - buildkite-agent artifact upload nix-installer-x86_64-linux
- label: nix-installer-x86_64-linux-variants
agents:
system: x86_64-linux
nix: 1
command:
- nix --extra-experimental-features "nix-command flakes" develop --store ~/.ci-store --print-build-logs .# --command "cargo" build --no-default-features
- nix --extra-experimental-features "nix-command flakes" develop --store ~/.ci-store --print-build-logs .# --command "cargo" build --all-features
- nix --extra-experimental-features "nix-command flakes" build --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.nix-installer
- label: nix-installer-i686-linux - label: nix-installer-i686-linux
agents: agents:
system: x86_64-linux system: x86_64-linux

View file

@ -12,7 +12,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache lint store (x86_64-linux) - name: Cache lint store (x86_64-linux)
@ -29,78 +29,44 @@ jobs:
run: nix develop --store ~/.ci-store --command check-nixpkgs-fmt run: nix develop --store ~/.ci-store --command check-nixpkgs-fmt
- name: Check EditorConfig conformance - name: Check EditorConfig conformance
run: nix develop --store ~/.ci-store --command check-editorconfig run: nix develop --store ~/.ci-store --command check-editorconfig
- name: Download Buildkite Artifacts
build-x86_64-linux: uses: EnricoMi/download-buildkite-artifact-action@v1.14
name: Build x86_64 Linux
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} buildkite_token: ${{ secrets.BUILDKITE_TOKEN }}
- name: Cache build store (x86_64-linux) output_path: artifacts
id: build-store-x86_64-linux - name: Output list of Buildkite artifacts
uses: actions/cache@v3
with:
path: ~/.ci-store
key: build-store-x86_64-linux-${{ hashFiles('**/Cargo.lock', '**/flake.lock') }}-v1
- name: Build `nix-installer-static`
run: nix build --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.nix-installer-static
- name: Copy artifact
run: | run: |
RESULT=$(nix eval --raw --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.nix-installer-static --apply "x: \"$HOME/.ci-store\${x}\"") ls -lah artifacts/
cp $RESULT/bin/nix-installer nix-installer ls -lah artifacts/**/*
- name: Create artifact for x86_64-linux nix-installer # Mac's can't run this action, so we're forced to do this.
uses: actions/upload-artifact@v3 - name: Create Github cache from Buildkite artifacts
id: cache-buildkite-artifacts
uses: actions/cache/save@v3
with: with:
name: nix-installer-x86_64-linux path: artifacts
path: | key: buildkite-artifacts-${{ github.sha }}
nix-installer
# Various feature variations or versions of the build which we expect to always work
# Since it uses the `build-store-x86_64-linux-*` cache it should be quite fast
build-variants-x86_64-linux:
name: Build x86_64 Linux (Variants)
runs-on: ubuntu-22.04
needs: build-x86_64-linux # Only run this if the normal checks work, to avoid clogging builders
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache build store (x86_64-linux)
id: build-store-x86_64-linux
uses: actions/cache@v3
with:
path: ~/.ci-store
key: build-store-x86_64-linux-${{ hashFiles('**/Cargo.lock', '**/flake.lock') }}-v1
- name: Build `nix-installer`
run: nix build --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.nix-installer
- name: Test `nix develop` build without default features
run: nix develop --store ~/.ci-store --print-build-logs .# --command "cargo" build --no-default-features
- name: Test `nix develop` build all features
run: nix develop --store ~/.ci-store --print-build-logs .# --command "cargo" build --all-features
run-x86_64-linux: run-x86_64-linux:
name: Run x86_64 Linux name: Run x86_64 Linux
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: [build-x86_64-linux, lints] needs: [lints]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: sudo apt install fish zsh - name: Restore Github cache of Buildkite artifacts
- uses: actions/download-artifact@v3 id: cache-buildkite-artifacts
uses: actions/cache/restore@v3
with: with:
name: nix-installer-x86_64-linux path: artifacts
key: buildkite-artifacts-${{ github.sha }}
- run: sudo apt install fish zsh
- name: Move & set executable - name: Move & set executable
run: | run: |
chmod +x ./nix-installer
mkdir install-root mkdir install-root
cp nix-installer.sh install-root/nix-installer.sh cp nix-installer.sh install-root/nix-installer.sh
mv nix-installer install-root/nix-installer-x86_64-linux mv ./artifacts/nix-installer-x86_64-linux-*/* install-root/nix-installer-x86_64-linux
chmod +x install-root/nix-installer-x86_64-linux install-root/nix-installer.sh
- name: Initial install - name: Initial install
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
local-root: install-root/ local-root: install-root/
logger: pretty logger: pretty
@ -129,7 +95,7 @@ jobs:
exit 1 exit 1
fi fi
- name: Repeated install - name: Repeated install
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
local-root: install-root/ local-root: install-root/
logger: pretty logger: pretty
@ -187,21 +153,24 @@ jobs:
run-x86_64-linux-no-init: run-x86_64-linux-no-init:
name: Run x86_64 Linux (No init) name: Run x86_64 Linux (No init)
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: [build-x86_64-linux, lints] needs: [lints]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: sudo apt install fish zsh - name: Restore Github cache of Buildkite artifacts
- uses: actions/download-artifact@v3 id: cache-buildkite-artifacts
uses: actions/cache/restore@v3
with: with:
name: nix-installer-x86_64-linux path: artifacts
key: buildkite-artifacts-${{ github.sha }}
- run: sudo apt install fish zsh
- name: Move & set executable - name: Move & set executable
run: | run: |
chmod +x ./nix-installer
mkdir install-root mkdir install-root
cp nix-installer.sh install-root/nix-installer.sh cp nix-installer.sh install-root/nix-installer.sh
mv nix-installer install-root/nix-installer-x86_64-linux mv ./artifacts/nix-installer-x86_64-linux-*/* install-root/nix-installer-x86_64-linux
chmod +x install-root/nix-installer-x86_64-linux install-root/nix-installer.sh
- name: Initial install - name: Initial install
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
init: none init: none
planner: linux planner: linux
@ -234,7 +203,7 @@ jobs:
exit 1 exit 1
fi fi
- name: Repeated install - name: Repeated install
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
init: none init: none
planner: linux planner: linux
@ -294,19 +263,22 @@ jobs:
run-steam-deck: run-steam-deck:
name: Run Steam Deck (mock) name: Run Steam Deck (mock)
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: [build-x86_64-linux, lints] needs: [lints]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: sudo apt install fish zsh - name: Restore Github cache of Buildkite artifacts
- uses: actions/download-artifact@v3 id: cache-buildkite-artifacts
uses: actions/cache/restore@v3
with: with:
name: nix-installer-x86_64-linux path: artifacts
key: buildkite-artifacts-${{ github.sha }}
- run: sudo apt install fish zsh
- name: Move & set executable - name: Move & set executable
run: | run: |
chmod +x ./nix-installer
mkdir install-root mkdir install-root
cp nix-installer.sh install-root/nix-installer.sh cp nix-installer.sh install-root/nix-installer.sh
mv nix-installer install-root/nix-installer-x86_64-linux mv ./artifacts/nix-installer-x86_64-linux-*/* install-root/nix-installer-x86_64-linux
chmod +x install-root/nix-installer-x86_64-linux install-root/nix-installer.sh
- name: Make the CI look like a steam deck - name: Make the CI look like a steam deck
run: | run: |
mkdir -p ~/bin mkdir -p ~/bin
@ -314,7 +286,7 @@ jobs:
sudo chmod +x /bin/steamos-readonly sudo chmod +x /bin/steamos-readonly
sudo useradd -m deck sudo useradd -m deck
- name: Initial install - name: Initial install
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
local-root: install-root/ local-root: install-root/
logger: pretty logger: pretty
@ -349,7 +321,7 @@ jobs:
exit 1 exit 1
fi fi
- name: Repeated install - name: Repeated install
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
local-root: install-root/ local-root: install-root/
logger: pretty logger: pretty
@ -410,43 +382,27 @@ jobs:
exit 1 exit 1
fi fi
build-x86_64-darwin:
name: Build x86_64 Darwin
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Runs clippy as part of the preBuild.
- name: Build nix-installer
run: nix build .#packages.x86_64-darwin.nix-installer -L
- name: Create artifact for x86_64-darwin nix-installer
uses: actions/upload-artifact@v3
with:
name: nix-installer-x86_64-darwin
path: |
result/bin/nix-installer
run-x86_64-darwin: run-x86_64-darwin:
name: Run x86_64 Darwin name: Run x86_64 Darwin
runs-on: macos-12 runs-on: macos-12
needs: [build-x86_64-darwin, lints] needs: [lints]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: brew install fish coreutils - name: Restore Github cache of Buildkite artifacts
- uses: actions/download-artifact@v3 id: cache-buildkite-artifacts
uses: actions/cache/restore@v3
with: with:
name: nix-installer-x86_64-darwin path: artifacts
key: buildkite-artifacts-${{ github.sha }}
- run: brew install fish coreutils
- name: Move & set executable - name: Move & set executable
run: | run: |
chmod +x ./nix-installer
mkdir install-root mkdir install-root
cp nix-installer.sh install-root/nix-installer.sh cp nix-installer.sh install-root/nix-installer.sh
mv nix-installer install-root/nix-installer-x86_64-darwin mv ./artifacts/nix-installer-x86_64-darwin-*/* install-root/nix-installer-x86_64-darwin
chmod +x install-root/nix-installer-x86_64-darwin install-root/nix-installer.sh
- name: Initial install - name: Initial install
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
local-root: install-root/ local-root: install-root/
logger: pretty logger: pretty
@ -463,7 +419,7 @@ jobs:
NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=trace NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=trace
RUST_BACKTRACE: full RUST_BACKTRACE: full
- name: Repeated install - name: Repeated install
uses: DeterminateSystems/nix-installer-action@start-daemon-and-init uses: DeterminateSystems/nix-installer-action@main
with: with:
local-root: install-root/ local-root: install-root/
logger: pretty logger: pretty