mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 23:31:24 +01:00
move ci job scipts into an actual script
This will make it possible/easier to: * share code between jobs * run jobs locally
This commit is contained in:
parent
d4ffa78979
commit
540cc89c83
3 changed files with 57 additions and 6 deletions
|
|
@ -42,9 +42,7 @@ ci:
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||||
script:
|
script:
|
||||||
- direnv exec . nix-build-and-cache ci
|
- direnv exec . job ci
|
||||||
|
|
||||||
- direnv exec . engage
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- target
|
- target
|
||||||
|
|
@ -57,7 +55,7 @@ artifacts:
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||||
script:
|
script:
|
||||||
- direnv exec . nix-build-and-cache packages
|
- direnv exec . job artifacts
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
|
@ -65,8 +63,7 @@ pages:
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
script:
|
script:
|
||||||
- nix build .#website-root
|
- direnv exec . job pages
|
||||||
- cp --recursive --dereference result public
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
|
|
||||||
52
bin/job
Executable file
52
bin/job
Executable file
|
|
@ -0,0 +1,52 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
job_artifacts() (
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
nix-build-and-cache packages
|
||||||
|
)
|
||||||
|
|
||||||
|
job_ci() (
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
nix-build-and-cache ci
|
||||||
|
direnv exec . engage
|
||||||
|
)
|
||||||
|
|
||||||
|
job_pages() (
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
nix build .#website-root
|
||||||
|
cp --recursive --dereference result public
|
||||||
|
)
|
||||||
|
|
||||||
|
bail() (
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Job failed"
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
|
||||||
|
run() (
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ -z "${1+x}" ]]; then
|
||||||
|
echo "You must supply a job to run. Available jobs:"
|
||||||
|
declare -F | rg \
|
||||||
|
--only-matching \
|
||||||
|
--color never \
|
||||||
|
--replace '* $1' \
|
||||||
|
'^declare -f job_(.*)$'
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
job="$1"
|
||||||
|
|
||||||
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
job_"$job" || bail
|
||||||
|
)
|
||||||
|
|
||||||
|
run "$@"
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
, markdownlint-cli
|
, markdownlint-cli
|
||||||
, mdbook
|
, mdbook
|
||||||
, mkShell
|
, mkShell
|
||||||
|
, ripgrep
|
||||||
, stdenv
|
, stdenv
|
||||||
, toolchain
|
, toolchain
|
||||||
}:
|
}:
|
||||||
|
|
@ -35,6 +36,7 @@ mkShell {
|
||||||
lychee
|
lychee
|
||||||
markdownlint-cli
|
markdownlint-cli
|
||||||
mdbook
|
mdbook
|
||||||
|
ripgrep
|
||||||
toolchain
|
toolchain
|
||||||
]
|
]
|
||||||
++
|
++
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue