Skip to content

Commit 45ba6d8

Browse files
committed
ci: conditional build
1 parent 05b4add commit 45ba6d8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
env:
9292
DOCKER_BUILDKIT: 1
9393
TEST_ENV: "true"
94-
run: docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml up -d --build
94+
run: docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml up ${{ matrix.skip_pytests != 'true' && '' || '-d' }} --build
9595

9696
- name: Wait for stack
9797
timeout-minutes: 20
@@ -101,29 +101,32 @@ jobs:
101101
done
102102
103103
- name: Run general functional tests
104+
if: ${{ matrix.skip_pytests != 'true' }}
104105
env:
105106
ML_BACKEND: ${{ matrix.backend_dir_name }}
106107
run: |
107108
pytest tests/ -vvv --ignore-glob='**/logs/*' --ignore-glob='**/data/*' --cov=. --cov-report=xml:tests/${{ matrix.backend_dir_name }}_coverage.xml
108109
109110
- name: Run per-ml-backend tests
111+
if: ${{ matrix.skip_pytests != 'true' }}
110112
env:
111113
ML_BACKEND: ${{ matrix.backend_dir_name }}
112114
run: |
113115
docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml exec -T ${{ matrix.backend_dir_name }} pytest -vvv --cov --cov-report=xml:/tmp/coverage.xml
114116
115117
- name: Copy per-ml-backend coverage.xml from the container
118+
if: ${{ matrix.skip_pytests != 'true' }}
116119
run: |
117120
docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml cp ${{ matrix.backend_dir_name }}:/tmp/coverage.xml label_studio_ml/examples/${{ matrix.backend_dir_name }}/coverage.xml
118121
119122
- name: Pull the logs
120-
if: always()
123+
if: always() && matrix.skip_pytests != 'true'
121124
env:
122125
DOCKER_BUILDKIT: 1
123126
run: docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml logs
124127

125128
- name: "Upload general coverage to Codecov"
126-
if: ${{ matrix.backend_dir_name == 'the_simplest_backend' }}
129+
if: ${{ matrix.backend_dir_name == 'the_simplest_backend' && matrix.skip_pytests != 'true' }}
127130
uses: codecov/[email protected]
128131
with:
129132
name: codecov-general
@@ -132,6 +135,7 @@ jobs:
132135
fail_ci_if_error: false
133136

134137
- name: "Upload ml-backend ${{ matrix.backend_dir_name }} coverage to Codecov"
138+
if: ${{ matrix.backend_dir_name == 'the_simplest_backend' && matrix.skip_pytests != 'true' }}
135139
uses: codecov/[email protected]
136140
with:
137141
name: codecov-${{ matrix.backend_dir_name }}
@@ -201,19 +205,21 @@ jobs:
201205
for (const backend of backends) {
202206
const config = docker_build_config.find(e => e.backend_dir_name === backend)
203207
let runs_on = "ubuntu-latest";
208+
let skip_pytests = "false";
204209
if (config) {
205210
console.log(`Config for ${backend}:`);
206211
console.log(config);
207212
if ((config.bypass ?? []).includes("pytests")) {
208213
console.log(`Skipping pytests for ${backend}`);
209-
continue;
214+
skip_pytests = "true";
210215
}
211216
runs_on = config.runs_on ?? "ubuntu-latest";
212217
} else {
213218
console.log(`Could not find config for ${backend}`);
214219
}
215-
matrixInclude.push({"backend_dir_name": backend, "runs_on": runs_on});
220+
matrixInclude.push({"backend_dir_name": backend, "runs_on": runs_on, "skip_pytests": skip_pytests});
216221
}
222+
console.log(`Matrix calculation result:`);
217223
console.log(matrixInclude);
218224
core.setOutput("matrix-include", matrixInclude);
219225

0 commit comments

Comments
 (0)