summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-12-30 10:31:17 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-12-30 13:45:01 -0500
commit46e72e56f867101a139e5116e7c5ef22b44c467e (patch)
treeb73371e38e9769b07627cc4579359d6bb9298a2d
parente50c2b3f231c71c04cbe65faadafb5f583cf46bb (diff)
downloadpython-coveragepy-git-nedbat/metacov-sparse-reports.tar.gz
build: use a sparse checkout for the reports reponedbat/metacov-sparse-reports
-rw-r--r--.github/workflows/coverage.yml21
1 files changed, 14 insertions, 7 deletions
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index b6cf37c8..dc5d2bbc 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -141,12 +141,14 @@ jobs:
steps:
- name: "Checkout reports repo"
- # TODO: sparse checkout would be great
- uses: actions/checkout@v2
- with:
- repository: nedbat/coverage-reports
- path: ./reports_repo
- token: ${{ secrets.COVERAGE_REPORTS_TOKEN }}
+ run: |
+ set -xe
+ git version
+ git clone --depth=1 --no-checkout https://${{ secrets.COVERAGE_REPORTS_TOKEN }}@github.com/nedbat/coverage-reports reports_repo
+ cd reports_repo
+ git sparse-checkout init --cone
+ git sparse-checkout set '/*' '!/reports'
+ git checkout main
- name: "Download coverage JSON report"
uses: actions/download-artifact@v2
@@ -156,6 +158,7 @@ jobs:
- name: "Compute info for later steps"
id: info
run: |
+ set -xe
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
export PCTINT=$(echo $TOTAL | cut -f1 -d.)
export SHA10=$(echo ${{ github.sha }} | cut -c 1-10)
@@ -181,6 +184,7 @@ jobs:
- name: "Push to report repo"
run: |
+ set -xe
# Make the redirect to the latest report.
echo "<html><head>" > reports_repo/latest.html
echo "<meta http-equiv='refresh' content='0;url=${{ env.url }}' />" >> reports_repo/latest.html
@@ -192,7 +196,10 @@ jobs:
echo "${{ env.sha10 }}: ${{ env.branch }}" >> commit.txt
# Commit.
cd ./reports_repo
- rm ${{ env.report_dir }}/.gitignore
+ git sparse-checkout set '/*' '!/reports'
+ git sparse-checkout set '/*' '${{ env.report_dir }}'
+ ls -al ${{ env.report_dir }}
+ rm -f ${{ env.report_dir }}/.gitignore
git add ${{ env.report_dir }}
git add latest.html
git config user.name nedbat