Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate and upload spoom coverage report on main #8047

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/sorbet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ jobs:

- run: bundle exec spoom coverage timeline --save

- uses: actions/upload-artifact@v3
- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: spoom_data
path: ./spoom_data/

- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: ./script/generate-coverage-report
env:
GH_TOKEN: ${{ github.token }}

- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: spoom_report
path: ./spoom_report.html
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ coverage/
.rdbg_history
# Ignore Jetbrains IntelliJ project-config directory
.idea/
# Ignore spoom coverage report
spoom_data/
spoom_report.html
21 changes: 21 additions & 0 deletions script/generate-coverage-report
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

total_snapshots=$(gh api -X GET /repos/dependabot/dependabot-core/actions/artifacts -f name=spoom_data -f per_page=100)
echo "$(jq -r '.total_count' <<< "$total_snapshots")" snapshots found in total

main_snapshots=$(jq -r '.artifacts[] | select(.name == "spoom_data" and .workflow_run.head_branch == "main") | .id' <<< "$total_snapshots")
echo "$(wc -w <<< "$main_snapshots")" snapshots found on main branch

for id in $main_snapshots; do
gh api /repos/dependabot/dependabot-core/actions/artifacts/"$id" | \
jq -r '.archive_download_url' | \
xargs gh api -X GET > spoom_data.zip && \
unzip -qq -o spoom_data.zip -d spoom_data && \
rm spoom_data.zip
done

echo Download complete

echo Generating coverage report
bundle exec spoom coverage report
Loading