Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 283106b

Browse files
author
Mira Ressel
committed
refactor cargo-check-benches logic
* fix fetch refspec * assume base is master if the api call fails * merge master into pr branch rather than the other way around; same effect but imo cleaner and more readable * don't re-fetch pr branch, we want to test the version our pipeline is running on
1 parent e359d8b commit 283106b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

scripts/ci/gitlab/pipeline/test.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,13 @@ cargo-check-benches:
9090
- !reference [.rusty-cachier, before_script]
9191
- !reference [.pipeline-stopper-vars, script]
9292
# merges in the master branch on PRs
93-
- |
94-
export BASE=$(curl -s -H "Authorization: Bearer ${GITHUB_PR_TOKEN}" https://api.github.com/repos/paritytech/substrate/pulls/${CI_COMMIT_REF_NAME} | jq .base.ref)
95-
- if [ $CI_COMMIT_REF_NAME != "master" ]; then
96-
git fetch origin +${BASE}:${BASE};
97-
git fetch origin +$CI_COMMIT_REF_NAME:$CI_COMMIT_REF_NAME;
98-
git checkout ${BASE};
93+
- 'if [ $CI_COMMIT_REF_NAME != "master" ]; then
94+
BASE=$(curl -s -H "Authorization: Bearer ${GITHUB_PR_TOKEN}" https://api.github.com/repos/paritytech/substrate/pulls/${CI_COMMIT_REF_NAME} | jq -r .base.ref);
95+
printf "Merging base branch %s\n" "${BASE:=master}";
9996
git config user.email "[email protected]";
100-
git merge $CI_COMMIT_REF_NAME --verbose --no-edit;
101-
fi
97+
git fetch origin "refs/heads/${BASE}";
98+
git merge --verbose --no-edit FETCH_HEAD;
99+
fi'
102100
parallel: 2
103101
script:
104102
- rusty-cachier snapshot create

0 commit comments

Comments
 (0)