Skip to content

Commit

Permalink
refactor cargo-check-benches logic
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Mira Ressel authored and breathx committed Apr 22, 2023
1 parent 87fb19d commit 536d5be
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scripts/ci/gitlab/pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,13 @@ cargo-check-benches:
- !reference [.rusty-cachier, before_script]
- !reference [.pipeline-stopper-vars, script]
# merges in the master branch on PRs
- |
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)
- if [ $CI_COMMIT_REF_NAME != "master" ]; then
git fetch origin +${BASE}:${BASE};
git fetch origin +$CI_COMMIT_REF_NAME:$CI_COMMIT_REF_NAME;
git checkout ${BASE};
- 'if [ $CI_COMMIT_REF_NAME != "master" ]; then
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);
printf "Merging base branch %s\n" "${BASE:=master}";
git config user.email "ci@gitlab.parity.io";
git merge $CI_COMMIT_REF_NAME --verbose --no-edit;
fi
git fetch origin "refs/heads/${BASE}";
git merge --verbose --no-edit FETCH_HEAD;
fi'
parallel: 2
script:
- rusty-cachier snapshot create
Expand Down

0 comments on commit 536d5be

Please sign in to comment.