diff --git a/.github/actions/mount-coverage-dir/action.yml b/.github/actions/mount-coverage-dir/action.yml index 7a79a713b77a..6688252c1959 100644 --- a/.github/actions/mount-coverage-dir/action.yml +++ b/.github/actions/mount-coverage-dir/action.yml @@ -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 diff --git a/.github/actions/upload-total-coverage/action.yml b/.github/actions/upload-total-coverage/action.yml index 1110a29e7347..d085292f5ab7 100644 --- a/.github/actions/upload-total-coverage/action.yml +++ b/.github/actions/upload-total-coverage/action.yml @@ -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 @@ -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}} - \ No newline at end of file + 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 \ No newline at end of file diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 30c579b6997c..88a3ddb3d7c4 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -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' @@ -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: