Skip to content

Commit 699b26f

Browse files
committed
add shared CI workflow
1 parent 2cbc394 commit 699b26f

File tree

2 files changed

+150
-9
lines changed

2 files changed

+150
-9
lines changed

.github/workflows/shared-ci.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Shared CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'libs/shared/**'
9+
- 'libs/shared'
10+
pull_request:
11+
paths:
12+
- 'libs/shared/**'
13+
- 'libs/shared'
14+
merge_group:
15+
paths:
16+
- 'libs/shared/**'
17+
- 'libs/shared'
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
# TODO: get mypy running
25+
shared-lint:
26+
name: Run Lint (Shared)
27+
uses: codecov/gha-workflows/.github/workflows/lint.yml@pr41
28+
with:
29+
working_directory: libs/shared
30+
31+
shared-codecovstartup:
32+
name: Codecov Startup (Shared)
33+
uses: codecov/gha-workflows/.github/workflows/codecov-startup.yml@pr41
34+
secrets: inherit
35+
with:
36+
working_directory: libs/shared
37+
38+
shared-test:
39+
name: Test (Shared)
40+
runs-on: ubuntu-latest
41+
defaults:
42+
run:
43+
working-directory: libs/shared
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
submodules: 'recursive'
49+
50+
- name: Install docker compose
51+
run: |
52+
sudo curl -SL https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
53+
sudo chmod +x /usr/local/bin/docker-compose
54+
55+
- name: Build test environment
56+
run: |
57+
make test_env.build
58+
59+
- name: Bring containers up
60+
run: |
61+
make test_env.up
62+
63+
- name: Run tests
64+
run: |
65+
make test_env.test
66+
67+
- uses: actions/upload-artifact@v4
68+
if: ${{ !cancelled() }}
69+
with:
70+
name: coveragefiles
71+
path: libs/shared/tests/*.coverage.xml
72+
73+
- uses: actions/upload-artifact@v4
74+
if: ${{ !cancelled() }}
75+
with:
76+
name: junitfiles
77+
path: libs/shared/tests/*junit*.xml
78+
79+
shared-upload-to-codecov:
80+
name: Upload to Codecov (shared)
81+
needs: [shared-test]
82+
runs-on: ubuntu-latest
83+
strategy:
84+
matrix:
85+
include:
86+
- codecov_url_secret: CODECOV_URL
87+
codecov_token_secret: CODECOV_ORG_TOKEN
88+
name: prod
89+
- codecov_url_secret: CODECOV_STAGING_URL
90+
codecov_token_secret: CODECOV_ORG_TOKEN_STAGING
91+
name: staging
92+
- codecov_url_secret: CODECOV_QA_URL
93+
codecov_token_secret: CODECOV_QA_ORG
94+
name: qa
95+
- codecov_url_secret: CODECOV_PUBLIC_QA_URL
96+
codecov_token_secret: CODECOV_PUBLIC_QA_TOKEN
97+
name: public qa
98+
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
with:
103+
fetch-depth: 0
104+
submodules: 'recursive'
105+
106+
- name: Download coverage
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: coveragefiles
110+
111+
- name: Download test results
112+
uses: actions/download-artifact@v4
113+
with:
114+
name: junitfiles
115+
116+
- name: Uploading unit test coverage (${{ matrix.name }})
117+
uses: codecov/codecov-action@v5
118+
with:
119+
files: ./tests/unit.coverage.xml
120+
flags: shared-docker-uploader
121+
disable_search: true
122+
# Strange workaround: API has a `codecov` directory in the repo root
123+
# which conflicts with the action's `codecov` binary
124+
use_pypi: true
125+
token: ${{ secrets[matrix.codecov_token_secret] }}
126+
url: ${{ secrets[matrix.codecov_url_secret] }}
127+
working-directory: libs/shared
128+
129+
- name: Uploading unit test results (${{ matrix.name }})
130+
uses: codecov/test-results-action@v1
131+
with:
132+
files: ./tests/unit.junit.xml
133+
flags: shared-docker-uploader
134+
disable_search: true
135+
token: ${{ secrets[matrix.codecov_token_secret] }}
136+
url: ${{ secrets[matrix.codecov_url_secret] }}
137+
# The coverage action will have installed codecovcli with pip. The
138+
# actual binary will be found in $PATH.
139+
binary: codecovcli
140+
working-directory: libs/shared
141+

codecov.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
ignore:
22
- "**tests**/test_*.py"
3-
comment:
4-
show_critical_paths: true
5-
6-
beta_groups:
7-
- "labels"
83

94
flag_management:
10-
individual_flags:
11-
- name: "smart-labels"
12-
carryforward: true
13-
carryforward_mode: "labels"
5+
default_rules:
6+
carryforward: true
7+
statuses:
8+
- type: project
9+
target: auto
10+
threshold: 1
11+
- type: patch
12+
target: 90
1413

1514
codecov:
15+
wait_for_ci: false
1616
require_ci_to_pass: false

0 commit comments

Comments
 (0)