Revert "Update coverage information (#4808)" (#4811)

This reverts commit e240ba5d737b0b0a465ba23a6f99a2e0d41ba5bb.
This commit is contained in:
Arseniy Zaostrovnykh 2025-03-21 10:34:52 +01:00 committed by GitHub
parent e240ba5d73
commit 0a35748341
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 65 additions and 75 deletions

View File

@ -31,99 +31,89 @@ jobs:
path: 'rspec' path: 'rspec'
token: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }} token: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }}
# - uses: actions/setup-python@v4 - uses: actions/setup-python@v4
# with: with:
# python-version: '3.9' python-version: '3.9'
# - name: 'Install Pipenv' - name: 'Install Pipenv'
# run: pip install pipenv run: pip install pipenv
# - name: 'Install coverage script dependencies' - name: 'Install coverage script dependencies'
# working-directory: 'rspec/rspec-tools' working-directory: 'rspec/rspec-tools'
# run: | run: |
# pipenv --python python3.9 install pipenv --python python3.9 install
# - name: 'Regenerate coverage information' - name: 'Regenerate coverage information'
# env: env:
# GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }} GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }}
# id: gen-coverage id: gen-coverage
# working-directory: 'rspec/rspec-tools' working-directory: 'rspec/rspec-tools'
# run: | run: |
# pipenv run rspec-tools update-coverage --rulesdir ../rules pipenv run rspec-tools update-coverage --rulesdir ../rules
# mv ./covered_rules.json ../frontend/public/covered_rules.json mv ./covered_rules.json ../frontend/public/covered_rules.json
# if git diff --exit-code ../frontend/public/covered_rules.json; then if git diff --exit-code ../frontend/public/covered_rules.json; then
# echo "new_coverage=false" >> "$GITHUB_OUTPUT" echo "new_coverage=false" >> "$GITHUB_OUTPUT"
# else else
# echo "new_coverage=true" >> "$GITHUB_OUTPUT" echo "new_coverage=true" >> "$GITHUB_OUTPUT"
# fi fi
# - name: 'Cancel if coverage did not change' - name: 'Cancel if coverage did not change'
# if: steps.gen-coverage.outputs.new_coverage != 'true' if: steps.gen-coverage.outputs.new_coverage != 'true'
# uses: andymckay/cancel-action@0.2 uses: andymckay/cancel-action@0.2
- name: 'Push the updated coverage file to a new branch' - name: 'Push the updated coverage file to a new branch'
id: create-temp-branch id: create-temp-branch
# if: steps.gen-coverage.outputs.new_coverage == 'true' if: steps.gen-coverage.outputs.new_coverage == 'true'
working-directory: 'rspec' working-directory: 'rspec'
run: | run: |
git config --global user.name "SonarTech" git config --global user.name "SonarTech"
git config --global user.email "sonartech@sonarsource.com" git config --global user.email "sonartech@sonarsource.com"
git checkout -b $TMP_BRANCH git checkout -b $TMP_BRANCH
echo "" >> frontend/public/covered_rules.json # TODO remove this line
git add frontend/public/covered_rules.json git add frontend/public/covered_rules.json
git commit -m "update coverage information" git commit -m "update coverage information"
git push --force-with-lease origin $TMP_BRANCH git push --force-with-lease origin $TMP_BRANCH
# - name: 'Wait for CI to succeed' - name: 'Wait for CI to succeed'
# if: steps.gen-coverage.outputs.new_coverage == 'true' if: steps.gen-coverage.outputs.new_coverage == 'true'
# uses: fountainhead/action-wait-for-check@v1.0.0 uses: fountainhead/action-wait-for-check@v1.0.0
# id: wait-for-build id: wait-for-build
# with: with:
# token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
# checkName: all_required_checks checkName: all_required_checks
# ref: ${{ env.TMP_BRANCH }} ref: ${{ env.TMP_BRANCH }}
# timeoutSeconds: 2400 timeoutSeconds: 2400
# intervalSeconds: 30 intervalSeconds: 30
- name: 'Create a PR' - name: 'Push the updated coverage to master'
id: crate-github-pr if: |
steps.gen-coverage.outputs.new_coverage == 'true' &&
steps.wait-for-build.outputs.conclusion == 'success' &&
(github.event_name != 'workflow_dispatch' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
working-directory: 'rspec' working-directory: 'rspec'
env:
GH_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }}
run: | run: |
PR_URL=$(gh pr create --head ${{ env.TMP_BRANCH }} --title "Update coverage information" --body "" --label "rspec system") git checkout master
gh pr merge $PR_URL git merge $TMP_BRANCH
git push origin master
# - name: 'Push the updated coverage to master' - name: 'Delete the temporary branch'
# if: | if: always() && steps.create-temp-branch.conclusion == 'success'
# steps.gen-coverage.outputs.new_coverage == 'true' && uses: dawidd6/action-delete-branch@v3
# steps.wait-for-build.outputs.conclusion == 'success' && with:
# (github.event_name != 'workflow_dispatch' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) github_token: ${{ secrets.GITHUB_TOKEN }}
# working-directory: 'rspec' branches: ${{ env.TMP_BRANCH}}
# run: |
# git checkout master
# git merge $TMP_BRANCH
# git push origin master
# - name: 'Delete the temporary branch' - name: 'Fail if the change breaks CI'
# if: always() && steps.create-temp-branch.conclusion == 'success' if: |
# uses: dawidd6/action-delete-branch@v3 steps.gen-coverage.outputs.new_coverage == 'true' &&
# with: steps.wait-for-build.outputs.conclusion != 'success'
# github_token: ${{ secrets.GITHUB_TOKEN }} run: exit 1
# branches: ${{ env.TMP_BRANCH}}
# - name: 'Fail if the change breaks CI' - name: 'Notify on slack about the failure'
# if: | if: ${{ failure() }}
# steps.gen-coverage.outputs.new_coverage == 'true' && env:
# steps.wait-for-build.outputs.conclusion != 'success' SLACK_API_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).slack_token }}
# run: exit 1 working-directory: 'rspec/rspec-tools'
run: |
# - name: 'Notify on slack about the failure' pipenv run rspec-tools notify-failure-on-slack \
# if: ${{ failure() }} --message "ERROR: failed to update rule coverage. See https://github.com/SonarSource/rspec/actions/runs/$GITHUB_RUN_ID" \
# env: --channel team-analysis-rspec
# SLACK_API_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).slack_token }}
# working-directory: 'rspec/rspec-tools'
# run: |
# pipenv run rspec-tools notify-failure-on-slack \
# --message "ERROR: failed to update rule coverage. See https://github.com/SonarSource/rspec/actions/runs/$GITHUB_RUN_ID" \
# --channel team-analysis-rspec

View File

@ -6739,4 +6739,4 @@
"S6359": "sonar-xml 2.4.0.3273", "S6359": "sonar-xml 2.4.0.3273",
"S6361": "sonar-xml 2.4.0.3273" "S6361": "sonar-xml 2.4.0.3273"
} }
} }