Skip to content

Commit c3b1ad7

Browse files
committed
update ci to use makefile target prefixes instead of working_directory
1 parent 1614d11 commit c3b1ad7

3 files changed

Lines changed: 84 additions & 33 deletions

File tree

.github/workflows/api-ci.yml

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
api-lint:
1818
name: Run Lint (API)
1919
if: ${{ inputs.skip == false }}
20-
uses: codecov/gha-workflows/.github/workflows/lint.yml@v1.2.31
20+
uses: codecov/gha-workflows/.github/workflows/lint.yml@v1.2.36
2121
with:
22-
working_directory: apps/codecov-api
22+
make_target_prefix: api.
2323

2424
api-mypy:
2525
name: Patch typing (API)
@@ -28,72 +28,98 @@ jobs:
2828
with:
2929
working_directory: apps/codecov-api
3030

31+
# Once we cut over to umbrella, we can just replace the default cache key in build-app.yml
32+
# and self-hosted.yml and get rid of this step.
33+
api-compute-reqs-cache-key:
34+
name: Compute cache key for requirements image
35+
runs-on: ubuntu-latest
36+
outputs:
37+
reqs-cache-key: ${{ steps.compute.outputs.cache-key }}
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
with:
42+
submodules: 'recursive'
43+
- id: compute
44+
run: |
45+
echo cache-key=${{ hashFiles('apps/codecov-api/uv.lock') }}-${{ hashFiles('docker/Dockerfile.requirements') }}-${{ hashFiles('libs/shared/**') }} >> "$GITHUB_OUTPUT"
46+
3147
api-build:
3248
name: Build App (API)
3349
if: ${{ inputs.skip == false }}
34-
uses: codecov/gha-workflows/.github/workflows/build-app.yml@v1.2.31
50+
needs: [api-compute-reqs-cache-key]
51+
uses: codecov/gha-workflows/.github/workflows/build-app.yml@v1.2.36
3552
secrets: inherit
3653
with:
3754
repo: ${{ vars.CODECOV_API_IMAGE_V2 || vars.CODECOV_API_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-api' }}
38-
working_directory: apps/codecov-api
55+
output_directory: apps/codecov-api
56+
make_target_prefix: api.
57+
reqs_cache_key: ${{ needs.api-compute-reqs-cache-key.outputs.reqs-cache-key }}
3958

4059
api-test:
4160
name: Test (API)
4261
if: ${{ inputs.skip == false }}
4362
needs: [api-build]
44-
uses: codecov/gha-workflows/.github/workflows/run-tests.yml@v1.2.35
63+
uses: codecov/gha-workflows/.github/workflows/run-tests.yml@v1.2.36
4564
secrets: inherit
4665
with:
4766
run_integration: false
4867
repo: ${{ vars.CODECOV_API_IMAGE_V2 || vars.CODECOV_API_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-api' }}
49-
working_directory: apps/codecov-api
68+
output_directory: apps/codecov-api
5069
flag_prefix: api
5170
pytest_rootdir: /app
71+
make_target_prefix: api.
5272

5373
api-build-self-hosted:
5474
name: Build Self Hosted (API)
5575
if: ${{ inputs.skip == false }}
5676
needs: [api-build, api-test]
57-
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.31
77+
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.36
5878
secrets: inherit
5979
with:
6080
repo: ${{ vars.CODECOV_API_IMAGE_V2 || vars.CODECOV_API_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-api' }}
61-
working_directory: apps/codecov-api
81+
output_directory: apps/codecov-api
82+
make_target_prefix: api.
83+
reqs_cache_key: ${{ needs.api-compute-reqs-cache-key.outputs.reqs-cache-key }}
6284

6385
api-staging:
6486
name: Push Staging Image (API)
6587
needs: [api-build, api-test]
6688
if: ${{ inputs.skip == false && github.event_name == 'push' && github.event.ref == 'refs/heads/staging' && github.repository_owner == 'codecov' }}
67-
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.2.31
89+
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.2.36
6890
secrets: inherit
6991
with:
7092
environment: staging
7193
repo: ${{ vars.CODECOV_API_IMAGE_V2 || vars.CODECOV_API_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-api' }}
72-
working_directory: apps/codecov-api
94+
output_directory: apps/codecov-api
7395
sentry_project: api
96+
make_target_prefix: api.
7497

7598
api-production:
7699
name: Push Production Image (API)
77100
needs: [api-build, api-test]
78101
if: ${{ inputs.skip == false && github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
79-
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.2.31
102+
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.2.36
80103
secrets: inherit
81104
with:
82105
environment: production
83106
repo: ${{ vars.CODECOV_API_IMAGE_V2 || vars.CODECOV_API_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-api' }}
84-
working_directory: apps/codecov-api
107+
output_directory: apps/codecov-api
85108
sentry_project: api
109+
make_target_prefix: api.
86110

87111
api-self-hosted:
88112
name: Push Self Hosted Image (API)
89113
needs: [api-build-self-hosted, api-test]
90114
secrets: inherit
91115
if: ${{ inputs.skip == false && github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
92-
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.31
116+
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.36
93117
with:
94118
push_rolling: true
95119
repo: ${{ vars.CODECOV_API_IMAGE_V2 || vars.CODECOV_API_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-api' }}
96-
working_directory: apps/codecov-api
120+
output_directory: apps/codecov-api
121+
make_target_prefix: api.
122+
reqs_cache_key: ${{ needs.api-compute-reqs-cache-key.outputs.reqs-cache-key }}
97123

98124
# This job works around a strange interaction between reusable workflows and
99125
# path filters.

.github/workflows/shared-ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
shared-lint:
1313
name: Run Lint (Shared)
1414
if: ${{ inputs.skip == false }}
15-
uses: codecov/gha-workflows/.github/workflows/lint.yml@v1.2.31
15+
uses: codecov/gha-workflows/.github/workflows/lint.yml@v1.2.36
1616
with:
17-
working_directory: libs/shared
17+
make_target_prefix: shared.
1818

1919
shared-benchmark:
2020
name: Benchmarks (Shared)
@@ -138,7 +138,6 @@ jobs:
138138
# The coverage action will have installed codecovcli with pip. The
139139
# actual binary will be found in $PATH.
140140
binary: codecovcli
141-
recurse_submodules: true
142141

143142
# This job works around a strange interaction between reusable workflows and
144143
# path filters.

.github/workflows/worker-ci.yml

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Worker CI
22

33
on:
44
workflow_call:
5-
inputs:
5+
inputs:
66
skip:
77
type: boolean
88
default: false
@@ -17,9 +17,9 @@ jobs:
1717
worker-lint:
1818
name: Run Lint (Worker)
1919
if: ${{ inputs.skip == false }}
20-
uses: codecov/gha-workflows/.github/workflows/lint.yml@v1.2.31
20+
uses: codecov/gha-workflows/.github/workflows/lint.yml@v1.2.36
2121
with:
22-
working_directory: apps/worker
22+
make_target_prefix: worker.
2323

2424
worker-mypy:
2525
name: Patch typing (Worker)
@@ -28,71 +28,97 @@ jobs:
2828
with:
2929
working_directory: apps/worker
3030

31+
# Once we cut over to umbrella, we can just replace the default cache key in build-app.yml
32+
# and self-hosted.yml and get rid of this step.
33+
worker-compute-reqs-cache-key:
34+
name: Compute cache key for requirements image
35+
runs-on: ubuntu-latest
36+
outputs:
37+
reqs-cache-key: ${{ steps.compute.outputs.cache-key }}
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
with:
42+
submodules: 'recursive'
43+
- id: compute
44+
run: |
45+
echo cache-key=${{ hashFiles('apps/worker/uv.lock') }}-${{ hashFiles('docker/Dockerfile.requirements') }}-${{ hashFiles('libs/shared/**') }} >> "$GITHUB_OUTPUT"
46+
3147
worker-build:
3248
name: Build App (Worker)
3349
if: ${{ inputs.skip == false }}
34-
uses: codecov/gha-workflows/.github/workflows/build-app.yml@v1.2.31
50+
needs: [worker-compute-reqs-cache-key]
51+
uses: codecov/gha-workflows/.github/workflows/build-app.yml@v1.2.36
3552
secrets: inherit
3653
with:
3754
repo: ${{ vars.CODECOV_WORKER_IMAGE_V2 || vars.CODECOV_WORKER_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-worker' }}
38-
working_directory: apps/worker
55+
output_directory: apps/worker
56+
make_target_prefix: worker.
57+
reqs_cache_key: ${{ needs.worker-compute-reqs-cache-key.outputs.reqs-cache-key }}
3958

4059
worker-test:
4160
name: Test (Worker)
4261
if: ${{ inputs.skip == false }}
4362
needs: [worker-build]
44-
uses: codecov/gha-workflows/.github/workflows/run-tests.yml@v1.2.35
63+
uses: codecov/gha-workflows/.github/workflows/run-tests.yml@v1.2.36
4564
secrets: inherit
4665
with:
4766
repo: ${{ vars.CODECOV_WORKER_IMAGE_V2 || vars.CODECOV_WORKER_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-worker' }}
48-
working_directory: apps/worker
67+
output_directory: apps/worker
4968
flag_prefix: worker
5069
pytest_rootdir: /app
70+
make_target_prefix: worker.
5171

5272
worker-build-self-hosted:
5373
name: Build Self Hosted (Worker)
5474
if: ${{ inputs.skip == false }}
5575
needs: [worker-build, worker-test]
56-
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.31
76+
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.36
5777
secrets: inherit
5878
with:
5979
repo: ${{ vars.CODECOV_WORKER_IMAGE_V2 || vars.CODECOV_WORKER_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-worker' }}
60-
working_directory: apps/worker
80+
output_directory: apps/worker
81+
make_target_prefix: worker.
82+
reqs_cache_key: ${{ needs.worker-compute-reqs-cache-key.outputs.reqs-cache-key }}
6183

6284
worker-staging:
6385
name: Push Staging Image (Worker)
6486
needs: [worker-build, worker-test]
6587
if: ${{ inputs.skip == false && github.event_name == 'push' && (github.event.ref == 'refs/heads/main' || github.event.ref == 'refs/heads/staging') && github.repository_owner == 'codecov' }}
66-
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.2.31
88+
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.2.36
6789
secrets: inherit
6890
with:
6991
environment: staging
7092
repo: ${{ vars.CODECOV_WORKER_IMAGE_V2 || vars.CODECOV_WORKER_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-worker' }}
71-
working_directory: apps/worker
93+
output_directory: apps/worker
7294
sentry_project: worker
95+
make_target_prefix: worker.
7396

7497
worker-production:
7598
name: Push Production Image (Worker)
7699
needs: [worker-build, worker-test]
77100
if: ${{ inputs.skip == false && github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
78-
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.2.31
101+
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.2.36
79102
secrets: inherit
80103
with:
81104
environment: production
82105
repo: ${{ vars.CODECOV_WORKER_IMAGE_V2 || vars.CODECOV_WORKER_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-worker' }}
83-
working_directory: apps/worker
106+
output_directory: apps/worker
84107
sentry_project: worker
108+
make_target_prefix: worker.
85109

86110
worker-self-hosted:
87111
name: Push Self Hosted Image (Worker)
88-
needs: [worker-build-self-hosted, worker-test]
112+
needs: [worker-compute-reqs-cache-key, worker-build-self-hosted, worker-test]
89113
secrets: inherit
90114
if: ${{ inputs.skip == false && github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
91-
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.31
115+
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.2.36
92116
with:
93117
push_rolling: true
94118
repo: ${{ vars.CODECOV_WORKER_IMAGE_V2 || vars.CODECOV_WORKER_IMAGE_V2_SELF_HOSTED || 'codecov/self-hosted-worker' }}
95-
working_directory: apps/worker
119+
output_directory: apps/worker
120+
make_target_prefix: worker.
121+
reqs_cache_key: ${{ needs.worker-compute-reqs-cache-key.outputs.reqs-cache-key }}
96122

97123
# This job works around a strange interaction between reusable workflows and
98124
# path filters.

0 commit comments

Comments
 (0)