mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 15:21:24 +01:00
run ci for each commit
GitLab doesn't seem to have built-in support for this because of course it doesn't. To do this, we move the job scripts to a different file to make it possible to share code between job scripts.
This commit is contained in:
parent
a5eba45472
commit
2265b6615e
1 changed files with 16 additions and 2 deletions
18
bin/job
18
bin/job
|
|
@ -24,8 +24,9 @@ job_pages() (
|
|||
bail() (
|
||||
set -euo pipefail
|
||||
|
||||
git show --shortstat
|
||||
echo
|
||||
echo "Job failed"
|
||||
echo "Failure caused by the above commit"
|
||||
exit 1
|
||||
)
|
||||
|
||||
|
|
@ -47,7 +48,20 @@ run() (
|
|||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
job_"$job" || bail
|
||||
if [[ -z "${CI_MERGE_REQUEST_DIFF_BASE_SHA+x}" ]]; then
|
||||
echo "Running against latest commit only..."
|
||||
|
||||
job_"$job" || bail
|
||||
else
|
||||
echo "Running against all commits since this branch's base..."
|
||||
|
||||
readarray -t commits < \
|
||||
<(git rev-list --reverse "$CI_MERGE_REQUEST_DIFF_BASE_SHA..HEAD")
|
||||
for commit in "${commits[@]}"; do
|
||||
git checkout "$commit"
|
||||
job_"$job" || bail
|
||||
done
|
||||
fi
|
||||
)
|
||||
|
||||
run "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue