Skip to content

Commit 67f1ed4

Browse files
committed
ci: Introduce backend-all-green as a "must-be-green" job
1 parent aefff91 commit 67f1ed4

File tree

3 files changed

+69
-61
lines changed

3 files changed

+69
-61
lines changed

.github/workflows/backend.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,46 @@
11
name: backend
22

3-
on: [workflow_call]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
merge_group:
9+
types: [checks_requested]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions: {}
416

517
defaults:
618
run:
719
shell: "bash"
820

921
jobs:
22+
backend-changes:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
changes: ${{ steps.filter.outputs.backend }}
26+
permissions:
27+
pull-requests: read
28+
steps:
29+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
31+
id: filter
32+
with:
33+
filters: |
34+
backend:
35+
- '.github/workflows/backend.yml'
36+
- 'skore/**'
37+
1038
backend-lint:
1139
runs-on: "ubuntu-latest"
40+
needs: [backend-changes]
41+
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (contains(fromJSON('["pull_request", "merge_group"]'), github.event_name) && needs.backend-changes.outputs.changes == 'true') }}
42+
permissions:
43+
contents: read
1244
steps:
1345
- name: Checkout code
1446
uses: actions/checkout@v4
@@ -30,7 +62,10 @@ jobs:
3062
3163
backend-lockfiles:
3264
runs-on: "ubuntu-latest"
33-
if: ${{ github.event_name == 'pull_request' }}
65+
needs: [backend-changes]
66+
if: ${{ (contains(fromJSON('["pull_request", "merge_group"]'), github.event_name) && needs.backend-changes.outputs.changes == 'true') }}
67+
permissions:
68+
contents: read
3469
steps:
3570
- name: Checkout code
3671
uses: actions/checkout@v4
@@ -50,6 +85,8 @@ jobs:
5085
fi
5186
5287
backend-test:
88+
needs: [backend-changes]
89+
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (contains(fromJSON('["pull_request", "merge_group"]'), github.event_name) && needs.backend-changes.outputs.changes == 'true') }}
5390
strategy:
5491
fail-fast: false
5592
matrix:
@@ -68,6 +105,8 @@ jobs:
68105
scikit-learn: "1.6"
69106
coverage: true
70107
runs-on: ${{ matrix.os }}
108+
permissions:
109+
contents: read
71110
steps:
72111
- name: Checkout code
73112
uses: actions/checkout@v4
@@ -132,8 +171,7 @@ jobs:
132171

133172
- name: Show dependencies versions
134173
working-directory: skore/
135-
run: |
136-
python -c "import skore; skore.show_versions()"
174+
run: python -c 'import skore; skore.show_versions()'
137175

138176
- name: Test without coverage
139177
if: ${{ ! matrix.coverage }}
@@ -155,3 +193,16 @@ jobs:
155193
with:
156194
name: backend-coverage
157195
path: skore/coverage/
196+
197+
backend-all-green:
198+
needs:
199+
- backend-changes
200+
- backend-lint
201+
- backend-lockfiles
202+
- backend-test
203+
if: ${{ always() }}
204+
runs-on: Ubuntu-latest
205+
steps:
206+
- shell: bash
207+
run: |
208+
[[ ${{ contains(needs.*.result, 'failure') }} = false ]]

.github/workflows/ci.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
name: lint
22

3-
on: [workflow_call]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
merge_group:
9+
types: [checks_requested]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
417

518
defaults:
619
run:

0 commit comments

Comments
 (0)