summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2021-11-18 13:00:39 +0100
committerGitHub <noreply@github.com>2021-11-18 13:00:39 +0100
commit8f7640dbefd1adbd7e4104a404fa018f851776b5 (patch)
treee1006ae693b44360ec92913ad89eb1545bad7a81 /.github/workflows
parent7ee736a158ea9da955c54a282149208200865903 (diff)
downloadspack-8f7640dbefd1adbd7e4104a404fa018f851776b5.tar.gz
spack-8f7640dbefd1adbd7e4104a404fa018f851776b5.tar.bz2
spack-8f7640dbefd1adbd7e4104a404fa018f851776b5.tar.xz
spack-8f7640dbefd1adbd7e4104a404fa018f851776b5.zip
ci: run style unit tests only if we target develop (#27472)
Some tests assume the base branch is develop, but this branch may not have been checked out.
Diffstat (limited to '.github/workflows')
-rwxr-xr-x.github/workflows/setup_git.sh9
-rw-r--r--.github/workflows/unit_tests.yaml2
2 files changed, 6 insertions, 5 deletions
diff --git a/.github/workflows/setup_git.sh b/.github/workflows/setup_git.sh
index bd79daf268..e319e07512 100755
--- a/.github/workflows/setup_git.sh
+++ b/.github/workflows/setup_git.sh
@@ -1,9 +1,8 @@
#!/usr/bin/env sh
git config --global user.email "spack@example.com"
git config --global user.name "Test User"
-# With fetch-depth: 0 we have a remote develop
-# but not a local branch. Don't do this on develop
-if [ "$(git branch --show-current)" != "develop" ]
-then
- git branch develop origin/develop
+
+# create a local pr base branch
+if [[ -n $GITHUB_BASE_REF ]]; then
+ git fetch origin "${GITHUB_BASE_REF}:${GITHUB_BASE_REF}"
fi
diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml
index 35722b9137..764a9cdcf0 100644
--- a/.github/workflows/unit_tests.yaml
+++ b/.github/workflows/unit_tests.yaml
@@ -211,6 +211,7 @@ jobs:
git clone "${{ github.server_url }}/${{ github.repository }}.git" && cd spack
git fetch origin "${{ github.ref }}:test-branch"
git checkout test-branch
+ . .github/workflows/setup_git.sh
bin/spack unit-test -x
- name: Run unit tests (only package tests)
if: ${{ needs.changes.outputs.with_coverage == 'false' }}
@@ -223,6 +224,7 @@ jobs:
git clone "${{ github.server_url }}/${{ github.repository }}.git" && cd spack
git fetch origin "${{ github.ref }}:test-branch"
git checkout test-branch
+ . .github/workflows/setup_git.sh
bin/spack unit-test -x -m "not maybeslow" -k "package_sanity"
# Test RHEL8 UBI with platform Python. This job is run