Skip to content

HelpersTask597_Configure_Codecov_for_coverage #598

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

Merged
merged 66 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
eea3a1c
testing
Shaunak01 Apr 21, 2025
5d29501
testing
Shaunak01 Apr 21, 2025
f6eb29d
testing
Shaunak01 Apr 21, 2025
d33dd79
testing
Shaunak01 Apr 21, 2025
bd3cf41
testing
Shaunak01 Apr 21, 2025
fac66d6
testing
Shaunak01 Apr 21, 2025
0c20303
testing
Shaunak01 Apr 22, 2025
a5a72bb
testing
Shaunak01 Apr 22, 2025
7b7e2f1
testing
Shaunak01 Apr 22, 2025
07aaefd
testing
Shaunak01 Apr 22, 2025
c41a94c
checkpoint
Shaunak01 Apr 22, 2025
48f52e9
checkpoint
Shaunak01 Apr 22, 2025
36e14e7
Merge branch 'master' into HelpersTask597_Configure_Codecov_for_coverage
Shaunak01 Apr 22, 2025
5068411
Merge branch 'master' into HelpersTask597_Configure_Codecov_for_coverage
dremdem Apr 23, 2025
a3495b7
checkpoint
Shaunak01 Apr 24, 2025
8e5071f
Merge branch 'HelpersTask597_Configure_Codecov_for_coverage' of githu…
Shaunak01 Apr 24, 2025
3166f88
Merge branch 'master' into HelpersTask597_Configure_Codecov_for_coverage
Shaunak01 Apr 24, 2025
714698b
test with superslow
Shaunak01 Apr 24, 2025
75c96d1
Merge branch 'HelpersTask597_Configure_Codecov_for_coverage' of githu…
Shaunak01 Apr 24, 2025
de3b70f
test
Shaunak01 Apr 24, 2025
ff2bb19
test
Shaunak01 Apr 24, 2025
927dbfc
test
Shaunak01 Apr 24, 2025
bbecbf7
test
Shaunak01 Apr 24, 2025
335366f
flag test
Shaunak01 Apr 24, 2025
04b7e00
flag test
Shaunak01 Apr 24, 2025
609b0d2
flag test
Shaunak01 Apr 24, 2025
e31fcee
test
Shaunak01 Apr 24, 2025
22a063f
test
Shaunak01 Apr 24, 2025
f56b038
test
Shaunak01 Apr 24, 2025
e9bf42a
test
Shaunak01 Apr 24, 2025
6dd275d
checkpoint
Shaunak01 Apr 24, 2025
0ff65c1
test
Shaunak01 Apr 28, 2025
67f4c9f
test
Shaunak01 Apr 28, 2025
988d1ad
test
Shaunak01 Apr 28, 2025
f532944
checkpoint
Shaunak01 Apr 28, 2025
0bbaadf
test
Shaunak01 Apr 29, 2025
7e82eb4
test
Shaunak01 Apr 29, 2025
6c6b587
test
Shaunak01 Apr 29, 2025
bac6d0b
test
Shaunak01 Apr 29, 2025
374b8af
test
Shaunak01 Apr 29, 2025
4fea59d
checkpoint
Shaunak01 Apr 29, 2025
bbba10f
checkpoint
Shaunak01 Apr 29, 2025
61aa34e
Merge branch 'master' into HelpersTask597_Configure_Codecov_for_coverage
dremdem Apr 30, 2025
f824084
test
Shaunak01 Apr 30, 2025
56033fa
Merge branch 'HelpersTask597_Configure_Codecov_for_coverage' of githu…
Shaunak01 Apr 30, 2025
8992d8a
test
Shaunak01 Apr 30, 2025
0b3e8e8
checkpoint
Shaunak01 Apr 30, 2025
af9b90b
test
Shaunak01 Apr 30, 2025
1e8850e
test
Shaunak01 Apr 30, 2025
0aba958
test
Shaunak01 Apr 30, 2025
d5f3b3f
test
Shaunak01 Apr 30, 2025
aaf03b4
test
Shaunak01 Apr 30, 2025
feb3d05
test
Shaunak01 Apr 30, 2025
b8e5bf3
debug
Shaunak01 Apr 30, 2025
e9ce5bf
test
Shaunak01 Apr 30, 2025
760786d
test
Shaunak01 Apr 30, 2025
0af1914
test
Shaunak01 May 1, 2025
023f94e
checkpoint
Shaunak01 May 1, 2025
1d7701c
checkpoint
Shaunak01 May 1, 2025
b6c70fa
Merge branch 'master' into HelpersTask597_Configure_Codecov_for_coverage
dremdem May 1, 2025
cf00538
Test
Shaunak01 May 1, 2025
8c202ca
Merge branch 'HelpersTask597_Configure_Codecov_for_coverage' of githu…
Shaunak01 May 1, 2025
8becd02
Test
Shaunak01 May 1, 2025
0d0e75a
Test
Shaunak01 May 1, 2025
ca1dacb
Checkpoint
Shaunak01 May 1, 2025
697e7bc
Merge branch 'master' into HelpersTask597_Configure_Codecov_for_coverage
Shaunak01 May 1, 2025
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
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[report]
# Glob pattern(s) of files to omit from the report.
omit =
*/devops/compose/*
*/helpers/test/outcomes/*/tmp.scratch/*
5 changes: 3 additions & 2 deletions .github/gh_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
boto3 >= 1.20.17
coverage
invoke
tqdm
s3fs
boto3 >= 1.20.17
tqdm
173 changes: 173 additions & 0 deletions .github/workflows/coverage_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: Test coverage

on:
workflow_dispatch: {}
# every day at 00:00 UTC.
schedule:
- cron: '0 0 * * *'

env:
CSFY_CI: true

permissions:
# Required to authenticate and retrieve temporary AWS credentials via OIDC.
id-token: write
# Required to fetch and check out code from the repository.
contents: read
# Required to authenticate and pull Docker images from GitHub Container Registry (GHCR).
packages: read


jobs:
run_test_coverage:
runs-on: ubuntu-latest

steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ vars.GH_ACTION_AWS_ROLE_ARN }}
role-session-name: ${{ vars.GH_ACTION_AWS_SESSION_NAME }}
aws-region: ${{ vars.CSFY_AWS_DEFAULT_REGION }}

- name: Login to GHCR
run: docker login ghcr.io -u gpsaggese -p ${{ secrets.GITHUB_TOKEN }}

- name: Cleanup
run: sudo chmod 777 -R .

- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Update PYTHONPATH
run: echo "PYTHONPATH=.:helpers" >> $GITHUB_ENV

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r .github/gh_requirements.txt

- name: Pull image from GHCR
run: docker pull ghcr.io/${{ github.repository }}:dev

# Only on scheduled runs, capture ISO weekday (1=Mon … 7=Sun).
- name: Set DAY_OF_WEEK
if: github.event_name == 'schedule'
run: echo "DAY_OF_WEEK=$(date -u +'%u')" >> $GITHUB_ENV

# This step is used to trigger the fast test coverage generation using the invoke task.
- name: Run Fast test and generate report
id: run_fast
continue-on-error: true
run: |
echo "Simulating fast test failure"
exit 1
# env:
# GH_ACTION_ACCESS_TOKEN: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
# CSFY_AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
# CSFY_AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
# CSFY_AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
# CSFY_AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}
# CSFY_ECR_BASE_PATH: ghcr.io/${{ github.repository_owner }}
# CSFY_AWS_S3_BUCKET: ${{ vars.CSFY_AWS_S3_BUCKET }}
# run: invoke run_coverage --suite fast

- name: Upload Fast Test Coverage to Codecov
id: upload_fast
# Only upload if the previous fast test run step succeeded (i.r report generated).
# failed step don’t generate a coverage report, so there's nothing to upload.
if: steps.run_fast.outcome == 'success'
continue-on-error: true
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
# Specify the Codecov flag name associated with this test suite.
# Required to separate coverage reports by type (e.g., fast, slow, superslow) inside the Codecov UI.
flags: fast
name: fast-test-coverage

- name: Run Slow test and generate report
id: run_slow
continue-on-error: true
env:
GH_ACTION_ACCESS_TOKEN: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
CSFY_AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
CSFY_AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
CSFY_AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
CSFY_AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}
CSFY_ECR_BASE_PATH: ghcr.io/${{ github.repository_owner }}
CSFY_AWS_S3_BUCKET: ${{ vars.CSFY_AWS_S3_BUCKET }}
run: invoke run_coverage --suite slow

- name: Upload Slow Test Coverage to Codecov
id: upload_slow
# Only upload if the previous slow test run step succeeded (i.r report generated).
if: steps.run_slow.outcome == 'success'
continue-on-error: true
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: slow
name: slow-test-coverage

- name: Run Superslow test and generate report
# Run only on scheduled jobs or manual trigger
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
env:
GH_ACTION_ACCESS_TOKEN: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
CSFY_AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
CSFY_AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
CSFY_AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
CSFY_AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}
CSFY_ECR_BASE_PATH: ghcr.io/${{ github.repository_owner }}
CSFY_AWS_S3_BUCKET: ${{ vars.CSFY_AWS_S3_BUCKET }}
run: |
# Only run superslow tests if it's Monday or a manual dispatch.
day_of_week=$(date +%u)
if [ "$day_of_week" = "1" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
invoke run_coverage --suite superslow
else
echo "Skipping superslow tests — not Monday and not manually triggered"
exit 0
fi

- name: Upload Superslow Test Coverage to Codecov
#TODO(Shaunak): Consider removing it when we turn this workflow into a reusable one.
if: steps.run_superslow.outcome == 'success'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: superslow
name: superslow-test-coverage

# Fail the job in CI if any of the fast/ slow run/ upload steps above failed.
- name: Fail if fast/slow test or upload failed
run: |
failed=""
if [ "${{ steps.run_fast.outcome }}" != "success" ]; then
echo "Fast test run failed"
failed="true"
fi
if [ "${{ steps.upload_fast.outcome }}" != "success" ]; then
echo "Fast test coverage upload failed"
failed="true"
fi
if [ "${{ steps.run_slow.outcome }}" != "success" ]; then
echo "Slow test run failed"
failed="true"
fi
if [ "${{ steps.upload_slow.outcome }}" != "success" ]; then
echo "Slow test coverage upload failed"
failed="true"
fi
if [ "$failed" = "true" ]; then
echo "At least one fast/slow test or upload step failed."
exit 1
fi
Loading
Loading