Skip to content

Commit bfdd12e

Browse files
committed
websever 01
1 parent 6d06960 commit bfdd12e

File tree

2 files changed

+37
-46
lines changed

2 files changed

+37
-46
lines changed

.github/workflows/_reusable-unit-test.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,25 @@ on:
1717
type: string
1818
default: "**/{service_name}/requirements/ci.txt"
1919
description: "Path pattern for dependencies to cache"
20+
test_mode:
21+
required: false
22+
type: string
23+
default: "standard"
24+
description: "Test mode to run (standard, isolated, with_db)"
25+
test_shard:
26+
required: false
27+
type: string
28+
default: ""
29+
description: "Test shard to run (e.g., 01, 02, 03, 04 for webserver)"
30+
pre_test_step:
31+
required: false
32+
type: string
33+
default: ""
34+
description: "Additional step to run before the test step"
2035

2136
jobs:
2237
unit_test:
23-
name: "[unit] ${{ inputs.service_name }}"
38+
name: "[unit] ${{ inputs.service_name }}${{ inputs.test_shard != '' && ' ' || '' }}${{ inputs.test_shard }}"
2439
timeout-minutes: ${{ inputs.timeout_minutes }}
2540
runs-on: ${{ matrix.os }}
2641
strategy:
@@ -51,9 +66,20 @@ jobs:
5166
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash install
5267
- name: typecheck
5368
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash typecheck
69+
# Pre-test step if specified
70+
- name: ${{ inputs.pre_test_step }}
71+
if: ${{ inputs.pre_test_step != '' && !cancelled() }}
72+
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash ${{ inputs.pre_test_step }}
73+
# Test step with different modes
5474
- name: test
55-
if: ${{ !cancelled() }}
75+
if: ${{ inputs.test_mode == 'standard' && !cancelled() }}
5676
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash test
77+
- name: test isolated
78+
if: ${{ inputs.test_mode == 'isolated' && !cancelled() }}
79+
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash test_isolated
80+
- name: test with db
81+
if: ${{ inputs.test_mode == 'with_db' && !cancelled() }}
82+
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash test_with_db ${{ inputs.test_shard }}
5783
- name: upload failed tests logs
5884
if: ${{ failure() }}
5985
uses: actions/upload-artifact@v4

.github/workflows/ci-testing-deploy.yml

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -283,50 +283,15 @@ jobs:
283283
unit-test-webserver-01:
284284
needs: changes
285285
if: ${{ needs.changes.outputs.webserver == 'true' || github.event_name == 'push' || github.event.inputs.force_all_builds == 'true' }}
286-
timeout-minutes: 25 # if this timeout gets too small, then split the tests
287-
name: "[unit] webserver 01"
288-
runs-on: ${{ matrix.os }}
289-
strategy:
290-
matrix:
291-
python: ["3.11"]
292-
os: [ubuntu-24.04]
293-
fail-fast: false
294-
steps:
295-
- uses: actions/checkout@v4
296-
- name: setup docker buildx
297-
id: buildx
298-
uses: docker/setup-buildx-action@v3
299-
with:
300-
driver: docker-container
301-
- name: setup python environment
302-
uses: actions/setup-python@v5
303-
with:
304-
python-version: ${{ matrix.python }}
305-
- name: install uv
306-
uses: astral-sh/setup-uv@v6
307-
with:
308-
version: "0.6.x"
309-
enable-cache: false
310-
cache-dependency-glob: "**/web/server/requirements/ci.txt"
311-
- name: show system version
312-
run: ./ci/helpers/show_system_versions.bash
313-
- name: install webserver
314-
run: ./ci/github/unit-testing/webserver.bash install
315-
- name: typecheck
316-
run: ./ci/github/unit-testing/webserver.bash typecheck
317-
- name: test isolated
318-
if: ${{ !cancelled() }}
319-
run: ./ci/github/unit-testing/webserver.bash test_isolated
320-
- name: test
321-
if: ${{ !cancelled() }}
322-
run: ./ci/github/unit-testing/webserver.bash test_with_db 01
323-
- uses: codecov/codecov-action@v5
324-
if: ${{ !cancelled() }}
325-
env:
326-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
327-
with:
328-
flags: unittests #optional
329-
286+
uses: ./.github/workflows/_reusable-unit-test.yml
287+
with:
288+
service_name: webserver
289+
timeout_minutes: 25
290+
dependency_path: "**/web/server/requirements/ci.txt"
291+
test_mode: "with_db"
292+
test_shard: "01"
293+
pre_test_step: "test_isolated"
294+
secrets: inherit
330295

331296
unit-test-webserver-02:
332297
needs: changes

0 commit comments

Comments
 (0)