Skip to content

Commit 06bf016

Browse files
committed
add conditions to all jobs except deploy to run when PR has integration test labels
1 parent e4af0d1 commit 06bf016

File tree

1 file changed

+49
-4
lines changed

1 file changed

+49
-4
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: build
55

66
on:
77
push:
8-
branches: [main, develop, 'GEN*', 'gen*']
8+
branches: [main, develop]
99
paths-ignore:
1010
- '**.md' # All Markdown files
1111
- '**/docs/**' # Documentation directory
@@ -44,6 +44,9 @@ jobs:
4444
(
4545
github.event_name == 'push' &&
4646
(github.ref_name == 'main' || github.ref_name == 'develop')
47+
) ||
48+
(
49+
github.event_name == 'release'
4750
)
4851
)
4952
runs-on: ubuntu-latest
@@ -73,7 +76,20 @@ jobs:
7376
7477
test:
7578
runs-on: ubuntu-latest
76-
if: github.event_name != 'pull_request'
79+
if: >-
80+
(
81+
(
82+
contains(github.event.pull_request.labels.*.name, 'run_integration_tests') &&
83+
github.event.pull_request.state == 'open'
84+
) ||
85+
(
86+
github.event_name == 'push' &&
87+
(github.ref_name == 'main' || github.ref_name == 'develop')
88+
) ||
89+
(
90+
github.event_name == 'release'
91+
)
92+
)
7793
strategy:
7894
matrix:
7995
python-version: ['3.10', 3.11]
@@ -105,7 +121,20 @@ jobs:
105121

106122
lint:
107123
runs-on: ubuntu-latest
108-
if: github.event_name != 'pull_request'
124+
if: >-
125+
(
126+
(
127+
contains(github.event.pull_request.labels.*.name, 'run_integration_tests') &&
128+
github.event.pull_request.state == 'open'
129+
) ||
130+
(
131+
github.event_name == 'push' &&
132+
(github.ref_name == 'main' || github.ref_name == 'develop')
133+
) ||
134+
(
135+
github.event_name == 'release'
136+
)
137+
)
109138
steps:
110139
- uses: actions/checkout@v4
111140
- uses: psf/black@stable
@@ -114,7 +143,20 @@ jobs:
114143

115144
build-container:
116145
needs: [test, lint]
117-
if: github.event_name != 'pull_request'
146+
if: >-
147+
(
148+
(
149+
contains(github.event.pull_request.labels.*.name, 'run_integration_tests') &&
150+
github.event.pull_request.state == 'open'
151+
) ||
152+
(
153+
github.event_name == 'push' &&
154+
(github.ref_name == 'main' || github.ref_name == 'develop')
155+
) ||
156+
(
157+
github.event_name == 'release'
158+
)
159+
)
118160
runs-on: ubuntu-latest
119161
permissions:
120162
contents: read
@@ -176,6 +218,9 @@ jobs:
176218
(
177219
github.event_name == 'push' &&
178220
(github.ref_name == 'main' || github.ref_name == 'develop')
221+
) ||
222+
(
223+
github.event_name == 'release'
179224
)
180225
)
181226
steps:

0 commit comments

Comments
 (0)