Skip to content

Commit 309aeba

Browse files
committed
ci: fix conditional build
1 parent 054d6c6 commit 309aeba

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,33 +91,37 @@ 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
97+
if: ${{ matrix.skip_pytests != 'true' }}
9798
timeout-minutes: 20
9899
run: |
99100
while [ "$(curl -s -o /dev/null -L -w ''%{http_code}'' "http://localhost:9090/health")" != "200" ]; do
100101
echo "=> Waiting for service to become available" && sleep 2s
101102
done
102103
103104
- name: Run general functional tests
105+
if: ${{ matrix.skip_pytests != 'true' }}
104106
env:
105107
ML_BACKEND: ${{ matrix.backend_dir_name }}
106108
run: |
107109
pytest tests/ -vvv --ignore-glob='**/logs/*' --ignore-glob='**/data/*' --cov=. --cov-report=xml:tests/${{ matrix.backend_dir_name }}_coverage.xml
108110
109111
- name: Run per-ml-backend tests
112+
if: ${{ matrix.skip_pytests != 'true' }}
110113
env:
111114
ML_BACKEND: ${{ matrix.backend_dir_name }}
112115
run: |
113116
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
114117
115118
- name: Copy per-ml-backend coverage.xml from the container
119+
if: ${{ matrix.skip_pytests != 'true' }}
116120
run: |
117121
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
118122
119123
- name: Pull the logs
120-
if: always()
124+
if: always() && matrix.skip_pytests != 'true'
121125
env:
122126
DOCKER_BUILDKIT: 1
123127
run: docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml logs
@@ -132,6 +136,7 @@ jobs:
132136
fail_ci_if_error: false
133137

134138
- name: "Upload ml-backend ${{ matrix.backend_dir_name }} coverage to Codecov"
139+
if: ${{ matrix.backend_dir_name == 'the_simplest_backend' }}
135140
uses: codecov/[email protected]
136141
with:
137142
name: codecov-${{ matrix.backend_dir_name }}
@@ -201,19 +206,21 @@ jobs:
201206
for (const backend of backends) {
202207
const config = docker_build_config.find(e => e.backend_dir_name === backend)
203208
let runs_on = "ubuntu-latest";
209+
let skip_pytests = "false";
204210
if (config) {
205211
console.log(`Config for ${backend}:`);
206212
console.log(config);
207213
if ((config.bypass ?? []).includes("pytests")) {
208214
console.log(`Skipping pytests for ${backend}`);
209-
continue;
215+
skip_pytests = "true";
210216
}
211217
runs_on = config.runs_on ?? "ubuntu-latest";
212218
} else {
213219
console.log(`Could not find config for ${backend}`);
214220
}
215-
matrixInclude.push({"backend_dir_name": backend, "runs_on": runs_on});
221+
matrixInclude.push({"backend_dir_name": backend, "runs_on": runs_on, "skip_pytests": skip_pytests});
216222
}
223+
console.log(`Matrix calculation result:`);
217224
console.log(matrixInclude);
218225
core.setOutput("matrix-include", matrixInclude);
219226

0 commit comments

Comments
 (0)