Build the workspace dependencies in their own step, skipped when they are already in Cachix, so their compile output no longer shares a log with the build, test and lint results. Steps do not share /nix/store, so later steps import the paths exported by that step, on pull requests as well. Push to Cachix in a separate step that alone holds the token and also runs when a build fails. Pass --quiet to nix in all steps, which removes the fetch lists and copying lines while keeping builder logs and errors.
83 lines
2.4 KiB
YAML
83 lines
2.4 KiB
YAML
when:
|
|
- repo: wvhulle/bootvine
|
|
event: [pull_request, push, manual]
|
|
|
|
variables:
|
|
- &nix_config
|
|
NIX_CONFIG: |
|
|
experimental-features = nix-command flakes
|
|
build-users-group =
|
|
accept-flake-config = true
|
|
- &on_pull_requests
|
|
- event: pull_request
|
|
|
|
steps:
|
|
- name: build-workspace-dependencies
|
|
image: nixos/nix:latest
|
|
depends_on: []
|
|
environment: *nix_config
|
|
commands:
|
|
- nix run --quiet .#build-unless-cached -- .#packages.x86_64-linux.workspace-dependencies
|
|
|
|
- name: build-and-test-bootvine
|
|
image: nixos/nix:latest
|
|
depends_on: [build-workspace-dependencies]
|
|
environment: *nix_config
|
|
commands:
|
|
- nix run --quiet .#import-exported-paths
|
|
- nix run --quiet .#build-and-export-paths -- .#checks.x86_64-linux.bootvine-build
|
|
|
|
- name: build-repo-tasks
|
|
image: nixos/nix:latest
|
|
depends_on: [build-workspace-dependencies]
|
|
environment: *nix_config
|
|
commands:
|
|
- nix run --quiet .#import-exported-paths
|
|
- nix run --quiet .#build-and-export-paths -- .#checks.x86_64-linux.repo-tasks-build
|
|
|
|
- name: upload-build-cache
|
|
image: nixos/nix:latest
|
|
depends_on: [build-and-test-bootvine, build-repo-tasks]
|
|
when:
|
|
- event: [push, manual]
|
|
branch: main
|
|
status: [success, failure]
|
|
environment:
|
|
<<: *nix_config
|
|
CACHIX_AUTH_TOKEN:
|
|
from_secret: cachix_auth_token
|
|
commands:
|
|
- nix run --quiet .#upload-exported-paths
|
|
|
|
- name: lint-rust-with-clippy
|
|
image: nixos/nix:latest
|
|
depends_on: [build-workspace-dependencies]
|
|
environment: *nix_config
|
|
commands:
|
|
- nix run --quiet .#import-exported-paths
|
|
- nix build --quiet --print-build-logs .#checks.x86_64-linux.clippy-lints
|
|
|
|
- name: check-rust-formatting
|
|
image: nixos/nix:latest
|
|
depends_on: [build-workspace-dependencies]
|
|
environment: *nix_config
|
|
commands:
|
|
- nix run --quiet .#import-exported-paths
|
|
- nix build --quiet --print-build-logs .#checks.x86_64-linux.rustfmt-formatting
|
|
|
|
- name: evaluate-flake-outputs
|
|
image: nixos/nix:latest
|
|
depends_on: []
|
|
environment: *nix_config
|
|
commands:
|
|
- nix flake check --quiet --no-build
|
|
|
|
- name: check-conventional-commit-messages
|
|
image: nixos/nix:latest
|
|
depends_on: []
|
|
when: *on_pull_requests
|
|
environment: *nix_config
|
|
commands:
|
|
- git fetch --quiet origin "$${CI_COMMIT_TARGET_BRANCH}"
|
|
- nix run --quiet .#check-conventional-commits -- FETCH_HEAD..HEAD
|