Skip to content

Commit

Permalink
CI: fix coverage for external pr (#5465)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoucheng361 authored Dec 27, 2024
1 parent 003c80b commit 53f57ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
9 changes: 7 additions & 2 deletions .github/actions/mount-coverage-dir/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ runs:
sudo wget -q s.juicefs.com/static/Linux/mount -O /root/.juicefs/jfsmount
sudo chmod +x /root/.juicefs/jfsmount
sudo curl -s -L https://juicefs.com/static/juicefs -o /usr/local/bin/juicefs && sudo chmod +x /usr/local/bin/juicefs
sudo juicefs auth ci-coverage --access-key ${{ inputs.access_key }} --secret-key ${{ inputs.secret_key }} --token ${{inputs.token}} --encrypt-keys
sudo juicefs mount ci-coverage --subdir ${subdir} ${{inputs.mount_point}} --allow-other
if [[ -n "${{inputs.access_key}}" && -n "${{inputs.secret_key}}" && -n "${{inputs.token}}" ]]; then
sudo juicefs auth ci-coverage --access-key ${{ inputs.access_key }} --secret-key ${{ inputs.secret_key }} --token ${{inputs.token}} --encrypt-keys
sudo juicefs mount ci-coverage --subdir ${subdir} ${{inputs.mount_point}} --allow-other
else
echo "no jfs secrets provided, use local dir instead of jfs"
mkdir -p ${{inputs.mount_point}}
fi
9 changes: 6 additions & 3 deletions .github/actions/upload-total-coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ runs:
fi
coverdirs=${coverdirs%,}
echo coverdirs is $coverdirs
[[ -z "$coverdirs" ]] && echo "no coverage dir found" && exit 1
[[ -z "$coverdirs" ]] && echo -e "\e[31m no coverage dir found\e[0m" && exit 0
sudo go tool covdata percent -i=$coverdirs | sudo tee cover/cover.percent
echo "generated coverage percent report:" $(realpath cover/cover.percent)
sudo go tool covdata textfmt -o cover/cover.txt -i=$coverdirs
Expand All @@ -34,5 +34,8 @@ runs:
- name: upload coverage report
shell: bash
run: |
.github/scripts/upload_coverage_report.sh cover/cover.html ${{github.workflow}}_${{github.run_id}}.html ${{inputs.UPLOAD_TOKEN}}
if [[ -f cover/cover.html ]]; then
.github/scripts/upload_coverage_report.sh cover/cover.html ${{github.workflow}}_${{github.run_id}}.html ${{inputs.UPLOAD_TOKEN}}
else
echo -e "\e[31m no coverage report found\e[0m" && exit 0
fi
7 changes: 7 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- '.github/scripts/sync/**'
- '.github/scripts/hypo/sync.py'
- '.github/scripts/hypo/sync_test.py'
- '.github/actions/upload-coverage/action.yml'
- '.github/actions/mount-coverage-dir/action.yml'
- '.github/actions/upload-total-coverage/action.yml'
pull_request:
branches:
- 'main'
Expand All @@ -23,6 +26,10 @@ on:
- '.github/scripts/sync/**'
- '.github/scripts/hypo/sync.py'
- '.github/scripts/hypo/sync_test.py'
- '.github/actions/upload-coverage/action.yml'
- '.github/actions/mount-coverage-dir/action.yml'
- '.github/actions/upload-total-coverage/action.yml'

workflow_dispatch:
inputs:
debug:
Expand Down

0 comments on commit 53f57ac

Please sign in to comment.