Skip to content

Commit 4c7d960

Browse files
authored
TutorialsTask536_Improve_GitHub_tutorials_2 (#551)
1 parent 2695dfa commit 4c7d960

File tree

2 files changed

+94
-59
lines changed

2 files changed

+94
-59
lines changed

.codecov.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
flag_management:
2+
individual_flags:
3+
- name: fast
4+
carryforward: true
5+
- name: slow
6+
carryforward: true
7+
- name: superslow
8+
carryforward: true
9+
10+
comment:
11+
layout: "reach, diff, files"
12+
behavior: default
13+
require_changes: false
14+
show_critical_paths: false
15+
16+
github_checks:
17+
annotations: false
18+
19+
coverage:
20+
status:
21+
project:
22+
default:
23+
# compare against the PR’s base commit coverage
24+
target: auto
25+
# fail if overall coverage drops by ≥1%
26+
threshold: 1%
27+
# only include these flags in the project-level check
28+
flags:
29+
- fast
30+
- slow
31+
- superslow
32+
# only run this check when targeting master
33+
branches:
34+
- master
35+
# turn on the patch-level coverage check
36+
patch: true

.github/workflows/test_coverage.yml

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
name: Test coverage
22
on:
3-
pull_request:
43
# Run manually.
54
workflow_dispatch: {}
65
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
76
# every day at 00:00 UTC.
8-
schedule:
9-
- cron: '0 0 * * *'
7+
# schedule:
8+
# - cron: '0 0 * * *'
109

1110
env:
1211
CSFY_CI: true
@@ -124,59 +123,59 @@ jobs:
124123
flags: slow
125124
name: slow-test-coverage
126125

127-
- name: Run Superslow test and generate report
128-
id: run_superslow
129-
env:
130-
GH_ACTION_ACCESS_TOKEN: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
131-
CSFY_AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
132-
CSFY_AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
133-
CSFY_AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
134-
CSFY_AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}
135-
CSFY_ECR_BASE_PATH: ghcr.io/${{ github.repository_owner }}
136-
CSFY_AWS_S3_BUCKET: ${{ vars.CSFY_AWS_S3_BUCKET }}
137-
run: |
138-
# Determine the day of the week (1 = Monday, 7 = Sunday).
139-
day_of_week=$(date +%u)
140-
# Only run superslow tests on Mondays or if the workflow is manually triggered.
141-
if [ "$day_of_week" = "1" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
142-
echo "Running superslow tests..."
143-
invoke run_coverage --suite superslow
144-
else
145-
echo "Skipping superslow tests — today is not Monday and this is not a manual trigger"
146-
exit 0
147-
fi
148-
149-
- name: Upload Superslow Test Coverage to Codecov
150-
#TODO(Shaunak): Consider removing it when we turn this workflow into a reusable one.
151-
if: steps.run_superslow.outcome == 'success'
152-
uses: codecov/codecov-action@v5
153-
with:
154-
token: ${{ secrets.CODECOV_TOKEN }}
155-
files: ./coverage.xml
156-
flags: superslow
157-
name: superslow-test-coverage
158-
159-
# Fail the job in CI if any of the fast/ slow run/ upload steps above failed.
160-
- name: Fail if fast/slow test or upload failed
161-
run: |
162-
failed=""
163-
if [ "${{ steps.run_fast.outcome }}" != "success" ]; then
164-
echo "Fast test run failed"
165-
failed="true"
166-
fi
167-
if [ "${{ steps.upload_fast.outcome }}" != "success" ]; then
168-
echo "Fast test coverage upload failed"
169-
failed="true"
170-
fi
171-
if [ "${{ steps.run_slow.outcome }}" != "success" ]; then
172-
echo "Slow test run failed"
173-
failed="true"
174-
fi
175-
if [ "${{ steps.upload_slow.outcome }}" != "success" ]; then
176-
echo "Slow test coverage upload failed"
177-
failed="true"
178-
fi
179-
if [ "$failed" = "true" ]; then
180-
echo "At least one fast/slow test or upload step failed."
181-
exit 1
182-
fi
126+
# - name: Run Superslow test and generate report
127+
# id: run_superslow
128+
# env:
129+
# GH_ACTION_ACCESS_TOKEN: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
130+
# CSFY_AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
131+
# CSFY_AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
132+
# CSFY_AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
133+
# CSFY_AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}
134+
# CSFY_ECR_BASE_PATH: ghcr.io/${{ github.repository_owner }}
135+
# CSFY_AWS_S3_BUCKET: ${{ vars.CSFY_AWS_S3_BUCKET }}
136+
# run: |
137+
# # Determine the day of the week (1 = Monday, 7 = Sunday).
138+
# day_of_week=$(date +%u)
139+
# # Only run superslow tests on Mondays or if the workflow is manually triggered.
140+
# if [ "$day_of_week" = "1" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
141+
# echo "Running superslow tests..."
142+
# invoke run_coverage --suite superslow
143+
# else
144+
# echo "Skipping superslow tests — today is not Monday and this is not a manual trigger"
145+
# exit 0
146+
# fi
147+
148+
# - name: Upload Superslow Test Coverage to Codecov
149+
# #TODO(Shaunak): Consider removing it when we turn this workflow into a reusable one.
150+
# if: steps.run_superslow.outcome == 'success'
151+
# uses: codecov/codecov-action@v5
152+
# with:
153+
# token: ${{ secrets.CODECOV_TOKEN }}
154+
# files: ./coverage.xml
155+
# flags: superslow
156+
# name: superslow-test-coverage
157+
158+
# # Fail the job in CI if any of the fast/ slow run/ upload steps above failed.
159+
# - name: Fail if fast/slow test or upload failed
160+
# run: |
161+
# failed=""
162+
# if [ "${{ steps.run_fast.outcome }}" != "success" ]; then
163+
# echo "Fast test run failed"
164+
# failed="true"
165+
# fi
166+
# if [ "${{ steps.upload_fast.outcome }}" != "success" ]; then
167+
# echo "Fast test coverage upload failed"
168+
# failed="true"
169+
# fi
170+
# if [ "${{ steps.run_slow.outcome }}" != "success" ]; then
171+
# echo "Slow test run failed"
172+
# failed="true"
173+
# fi
174+
# if [ "${{ steps.upload_slow.outcome }}" != "success" ]; then
175+
# echo "Slow test coverage upload failed"
176+
# failed="true"
177+
# fi
178+
# if [ "$failed" = "true" ]; then
179+
# echo "At least one fast/slow test or upload step failed."
180+
# exit 1
181+
# fi

0 commit comments

Comments
 (0)