From 1b2ff93dc4661d267386a15c7e0210dda91312a7 Mon Sep 17 00:00:00 2001 From: cpelley Date: Thu, 18 Dec 2025 15:28:58 +0000 Subject: [PATCH 1/7] debug change --- .github/workflows/ci.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5353e92eb3..f9788a3702 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Checkout dev branch uses: actions/checkout@v6 with: - fetch-depth: 0 + fetch-depth: 1 - name: Substitute branch name in environment file run: | @@ -40,9 +40,8 @@ jobs: - name: Checkout reference coverage report uses: actions/checkout@v6 with: - fetch-depth: 0 + fetch-depth: 1 path: covref - sparse-checkout: master/coverage_output.txt ref: coverage-reference - name: Environment creation @@ -71,7 +70,7 @@ jobs: - name: Compare coverage id: comp-coverage run: | - ls -R covref/ + ls -R covref/master/ pr_cov=$(grep TOTAL coverage_output.txt | awk '{print $NF}' | awk '{print substr($0, 1, length($0)-1)}') echo "pr_cov=$pr_cov" | tee -a $GITHUB_OUTPUT @@ -97,10 +96,9 @@ jobs: git config user.name github-actions[bot] git config user.email "github-actions[bot]@users.noreply.github.com" - git worktree add /tmp/coverage-ref coverage-reference + cd covref echo "=== clear out old reports for this branch ===" - cd /tmp/coverage-ref find . -path "./${BRANCH}_*" ! -name "index.html" -type f -delete find . -path "./${BRANCH}_*" -type d -empty -delete # replace contents of ./${BRANCH}_*/index.html with a message: "Outdated coverage report. Repository has been updated since." @@ -111,18 +109,17 @@ jobs: done if [ "${{ steps.comp-coverage.outputs.coverage_decreased }}" == "true" ]; then - cd - - mkdir /tmp/coverage-ref/${BRANCH}_${{ github.event.pull_request.head.sha }}/ - cp -r coverage_output.txt htmlcov/ /tmp/coverage-ref/${BRANCH}_${{ github.event.pull_request.head.sha }}/. + echo "=== adding new coverage report ===" + mkdir ${BRANCH}_${{ github.event.pull_request.head.sha }}/ + cp -r ../coverage_output.txt ../htmlcov/ ${BRANCH}_${{ github.event.pull_request.head.sha }}/. - cd /tmp/coverage-ref git add -f ${BRANCH}_${{ github.event.pull_request.head.sha }}/ fi echo "=== git status after add ===" - cd /tmp/coverage-ref git status -s + echo "=== git commit and push ===" git commit -a --amend --no-edit || echo "No changes to commit" git push origin -f coverage-reference From 6ddbff4663458bfe8e8276875f778e5be6a4487f Mon Sep 17 00:00:00 2001 From: cpelley Date: Fri, 19 Dec 2025 08:11:01 +0000 Subject: [PATCH 2/7] cache changes --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9788a3702..2545cc2403 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,22 @@ jobs: path: covref ref: coverage-reference + - name: Branch name + run: | + branch=$(echo "${GITHUB_HEAD_REF#refs/heads/}") + echo "BRANCH=$branch" | tee -a $GITHUB_ENV + + - name: Restore cached coverage report + uses: actions/cache/restore@v5 + id: report-cache-restore + with: + path: | + coverage_output.txt + htmlcov/ + key: coverage_report_${{ hashFiles('envs/latest.yml', 'improver/**/*.py', 'improver_tests/**/*.py') }} + - name: Environment creation + if: steps.report-cache-restore.outputs.cache-hit != 'true' uses: mamba-org/setup-micromamba@v2 with: environment-file: envs/latest.yml @@ -52,21 +67,27 @@ jobs: cache-environment: true - name: Environment info + if: steps.report-cache-restore.outputs.cache-hit != 'true' run: | micromamba info micromamba list shell: bash -el {0} - - name: Branch name - run: | - branch=$(echo "${GITHUB_HEAD_REF#refs/heads/}") - echo "BRANCH=$branch" | tee -a $GITHUB_ENV - - name: pytest + if: steps.report-cache-restore.outputs.cache-hit != 'true' run: | pytest --cov=improver --cov-report=term --cov-report=html | tee coverage_output.txt; test ${PIPESTATUS[0]} -eq 0 shell: micromamba-shell {0} + - name: Save cached coverage report + uses: actions/cache/restore@v5 + id: report-cache-save + with: + path: | + coverage_output.txt + htmlcov/ + key: ${{ steps.report-cache-restore.outputs.cache-primary-key }} + - name: Compare coverage id: comp-coverage run: | From e10db3a7ad660617bb073eee7d13ea7efc169cca Mon Sep 17 00:00:00 2001 From: cpelley Date: Fri, 19 Dec 2025 08:22:18 +0000 Subject: [PATCH 3/7] test coverage report publish --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2545cc2403..fbeda0e982 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,6 +109,8 @@ jobs: echo "coverage_decreased=false" | tee -a $GITHUB_OUTPUT fi fi + # TODO: remove once debugging complete + echo "coverage_decreased=true" | tee -a $GITHUB_OUTPUT - name: Coverage report on coverage-reference branch run: | From 243092eb96250d1bbfa16fd51046016db14d7697 Mon Sep 17 00:00:00 2001 From: cpelley Date: Fri, 19 Dec 2025 08:31:45 +0000 Subject: [PATCH 4/7] fixed cache save --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbeda0e982..dc9256c2e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: shell: micromamba-shell {0} - name: Save cached coverage report - uses: actions/cache/restore@v5 + uses: actions/cache/save@v5 id: report-cache-save with: path: | From 25942b4d56f54c898377450ca754e132586f2f5b Mon Sep 17 00:00:00 2001 From: cpelley Date: Fri, 19 Dec 2025 08:41:50 +0000 Subject: [PATCH 5/7] fix git user setup --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc9256c2e0..3619151495 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,11 +116,10 @@ jobs: run: | BRANCH=${{ env.BRANCH }} + cd covref git config user.name github-actions[bot] git config user.email "github-actions[bot]@users.noreply.github.com" - cd covref - echo "=== clear out old reports for this branch ===" find . -path "./${BRANCH}_*" ! -name "index.html" -type f -delete find . -path "./${BRANCH}_*" -type d -empty -delete From 998d37142910559d809b54019c898ec251f8589e Mon Sep 17 00:00:00 2001 From: cpelley Date: Fri, 19 Dec 2025 08:46:26 +0000 Subject: [PATCH 6/7] null change From e225ca87d2b42ca609865d4674e495f55d9b5a42 Mon Sep 17 00:00:00 2001 From: cpelley Date: Fri, 19 Dec 2025 08:50:51 +0000 Subject: [PATCH 7/7] remove debug force report publish --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3619151495..425e0a2f8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,8 +109,6 @@ jobs: echo "coverage_decreased=false" | tee -a $GITHUB_OUTPUT fi fi - # TODO: remove once debugging complete - echo "coverage_decreased=true" | tee -a $GITHUB_OUTPUT - name: Coverage report on coverage-reference branch run: |