From cf92641e4b54297d2dc6cb9ce7dc5f3905c029b4 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Fri, 13 Oct 2023 10:59:22 +0300 Subject: [PATCH 1/2] Fetch the full history of `master` before diff-ing it against HEAD The `Run tests` jobs were broken with https://github.com/bioconda/bioconda-utils/commit/1ae4126c5ba961667bc321c451957a50be305461 The problem is that the project uses `fetch-depth: 1` (the default) and thus has no branch history. Using `fetch-depth: 0` would fetch the whole history for **all** branches and tags, which would be unnecessary. Refs: - https://github.com/actions/checkout/issues/296 - https://github.com/actions/checkout/pull/301 Signed-off-by: Martin Tzvetanov Grigorov (cherry picked from commit e3c24c6cd45b62b35e9eca4f1147321d09eb2ca3) --- .github/workflows/GithubActionTests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GithubActionTests.yml b/.github/workflows/GithubActionTests.yml index 091b4d5e64..0f59a37ca7 100644 --- a/.github/workflows/GithubActionTests.yml +++ b/.github/workflows/GithubActionTests.yml @@ -42,7 +42,8 @@ jobs: run: | eval "$(conda shell.bash hook)" conda activate bioconda - if git diff --name-only origin/master...HEAD | grep -vE ^docs; then + git fetch origin master:refs/remotes/origin/master + if git diff --name-only HEAD..origin/master | grep -vE ^docs; then py.test --durations=0 test/ -v --log-level=DEBUG --tb=native -m '${{ matrix.py_test_marker }}' else echo "Skipping pytest - only docs modified" @@ -70,7 +71,8 @@ jobs: run: | eval "$(conda shell.bash hook)" conda activate bioconda - if git diff --name-only origin/master...HEAD | grep -vE ^docs; then + git fetch origin master:refs/remotes/origin/master + if git diff --name-only HEAD..origin/master | grep -vE ^docs; then py.test --durations=0 test/ -v --log-level=DEBUG -k "not docker" --tb=native else echo "Skipping pytest - only docs modified" From e0cf70e2232ebf90acee445477ac817d68f4d5f1 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Fri, 13 Oct 2023 11:23:11 +0300 Subject: [PATCH 2/2] Use `fetch-depth: 0` - it adds just 1sec more Signed-off-by: Martin Tzvetanov Grigorov --- .github/workflows/GithubActionTests.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GithubActionTests.yml b/.github/workflows/GithubActionTests.yml index 0f59a37ca7..bb319d1a28 100644 --- a/.github/workflows/GithubActionTests.yml +++ b/.github/workflows/GithubActionTests.yml @@ -17,6 +17,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: set path run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH @@ -42,8 +44,7 @@ jobs: run: | eval "$(conda shell.bash hook)" conda activate bioconda - git fetch origin master:refs/remotes/origin/master - if git diff --name-only HEAD..origin/master | grep -vE ^docs; then + if git diff --name-only origin/master...HEAD | grep -vE ^docs; then py.test --durations=0 test/ -v --log-level=DEBUG --tb=native -m '${{ matrix.py_test_marker }}' else echo "Skipping pytest - only docs modified" @@ -53,6 +54,8 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: set path run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH @@ -71,8 +74,7 @@ jobs: run: | eval "$(conda shell.bash hook)" conda activate bioconda - git fetch origin master:refs/remotes/origin/master - if git diff --name-only HEAD..origin/master | grep -vE ^docs; then + if git diff --name-only origin/master...HEAD | grep -vE ^docs; then py.test --durations=0 test/ -v --log-level=DEBUG -k "not docker" --tb=native else echo "Skipping pytest - only docs modified"