diff options
-rw-r--r-- | .github/workflows/linux_unit_tests.yaml | 12 | ||||
-rw-r--r-- | .github/workflows/macos_unit_tests.yaml | 4 | ||||
-rwxr-xr-x | .github/workflows/setup_git.sh | 9 | ||||
-rw-r--r-- | .github/workflows/style_and_docs.yaml | 4 |
4 files changed, 19 insertions, 10 deletions
diff --git a/.github/workflows/linux_unit_tests.yaml b/.github/workflows/linux_unit_tests.yaml index 454b859151..f1def14b6f 100644 --- a/.github/workflows/linux_unit_tests.yaml +++ b/.github/workflows/linux_unit_tests.yaml @@ -19,6 +19,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} @@ -35,9 +37,7 @@ jobs: run: | # Need this for the git tests to succeed. git --version - git config --global user.email "spack@example.com" - git config --global user.name "Test User" - git fetch -u origin develop:develop + . .github/workflows/setup_git.sh - name: Install kcov for bash script coverage env: KCOV_VERSION: 34 @@ -62,6 +62,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: actions/setup-python@v2 with: python-version: 3.8 @@ -78,9 +80,7 @@ jobs: run: | # Need this for the git tests to succeed. git --version - git config --global user.email "spack@example.com" - git config --global user.name "Test User" - git fetch -u origin develop:develop + . .github/workflows/setup_git.sh - name: Install kcov for bash script coverage env: KCOV_VERSION: 38 diff --git a/.github/workflows/macos_unit_tests.yaml b/.github/workflows/macos_unit_tests.yaml index 9a7c12ae5d..f4b55bab86 100644 --- a/.github/workflows/macos_unit_tests.yaml +++ b/.github/workflows/macos_unit_tests.yaml @@ -14,6 +14,8 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: actions/setup-python@v2 with: python-version: 3.7 @@ -30,7 +32,7 @@ jobs: - name: Run unit tests run: | git --version - git fetch -u origin develop:develop + . .github/workflows/setup_git.sh . share/spack/setup-env.sh coverage run $(which spack) test coverage combine diff --git a/.github/workflows/setup_git.sh b/.github/workflows/setup_git.sh new file mode 100755 index 0000000000..bd79daf268 --- /dev/null +++ b/.github/workflows/setup_git.sh @@ -0,0 +1,9 @@ +#!/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 +fi diff --git a/.github/workflows/style_and_docs.yaml b/.github/workflows/style_and_docs.yaml index 9fee85b163..2277d5598f 100644 --- a/.github/workflows/style_and_docs.yaml +++ b/.github/workflows/style_and_docs.yaml @@ -41,9 +41,7 @@ jobs: run: | # Need this for the git tests to succeed. git --version - git config --global user.email "spack@example.com" - git config --global user.name "Test User" - git fetch -u origin develop:develop + . .github/workflows/setup_git.sh - name: Run flake8 tests run: | share/spack/qa/run-flake8-tests |