skip jobs that don't make artifacts on main branch

This is okay because we only allow fast-forward merges, changes always
go through MRs, and MRs are subject to, e.g., the code quality checks.
This change is desirable because it should save some time and energy.
This commit is contained in:
Charles Hall 2024-11-01 14:23:03 -07:00
parent 976aef690f
commit f4dfb496e1
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
2 changed files with 14 additions and 1 deletions

View file

@ -35,11 +35,18 @@ before_script:
# Set CARGO_HOME to a cacheable path
- export CARGO_HOME="$(git rev-parse --show-toplevel)/.gitlab-ci.d/cargo"
ci:
cache-ci-deps:
stage: ci
image: nixos/nix:2.18.2
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script: direnv exec . job cache-ci-deps
ci:
stage: ci
image: nixos/nix:2.18.2
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- direnv exec . job ci

View file

@ -21,6 +21,12 @@ job_pages() (
chmod u+w -R public
)
job_cache-ci-deps() (
set -euo pipefail
nix-build-and-cache ci
)
bail() (
set -euo pipefail