Skip to content

Commit 6d06960

Browse files
committed
test
1 parent 9d62136 commit 6d06960

File tree

2 files changed

+79
-78
lines changed

2 files changed

+79
-78
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Reusable Unit Test Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
service_name:
7+
required: true
8+
type: string
9+
description: "The name of the service to test"
10+
timeout_minutes:
11+
required: false
12+
type: number
13+
default: 18
14+
description: "Timeout in minutes for the test job"
15+
dependency_path:
16+
required: false
17+
type: string
18+
default: "**/{service_name}/requirements/ci.txt"
19+
description: "Path pattern for dependencies to cache"
20+
21+
jobs:
22+
unit_test:
23+
name: "[unit] ${{ inputs.service_name }}"
24+
timeout-minutes: ${{ inputs.timeout_minutes }}
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
python: ["3.11"]
29+
os: [ubuntu-24.04]
30+
fail-fast: false
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: setup docker buildx
34+
id: buildx
35+
uses: docker/setup-buildx-action@v3
36+
with:
37+
driver: docker-container
38+
- name: setup python environment
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python }}
42+
- name: install uv
43+
uses: astral-sh/setup-uv@v6
44+
with:
45+
version: "0.6.x"
46+
enable-cache: false
47+
cache-dependency-glob: ${{ format(inputs.dependency_path, inputs.service_name) }}
48+
- name: show system version
49+
run: ./ci/helpers/show_system_versions.bash
50+
- name: install
51+
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash install
52+
- name: typecheck
53+
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash typecheck
54+
- name: test
55+
if: ${{ !cancelled() }}
56+
run: ./ci/github/unit-testing/${{ inputs.service_name }}.bash test
57+
- name: upload failed tests logs
58+
if: ${{ failure() }}
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: ${{ github.job }}_docker_logs
62+
path: ./services/${{ inputs.service_name }}/test_failures
63+
- uses: codecov/codecov-action@v5
64+
if: ${{ !cancelled() }}
65+
env:
66+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
67+
with:
68+
flags: unittests

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

Lines changed: 11 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -551,88 +551,21 @@ jobs:
551551
unit-test-notifications:
552552
needs: changes
553553
if: ${{ needs.changes.outputs.notifications == 'true' || github.event_name == 'push' || github.event.inputs.force_all_builds == 'true' }}
554-
timeout-minutes: 18 # if this timeout gets too small, then split the tests
555-
name: "[unit] notifications"
556-
runs-on: ${{ matrix.os }}
557-
strategy:
558-
matrix:
559-
python: ["3.11"]
560-
os: [ubuntu-24.04]
561-
fail-fast: false
562-
steps:
563-
- uses: actions/checkout@v4
564-
- name: setup docker buildx
565-
id: buildx
566-
uses: docker/setup-buildx-action@v3
567-
with:
568-
driver: docker-container
569-
- name: setup python environment
570-
uses: actions/setup-python@v5
571-
with:
572-
python-version: ${{ matrix.python }}
573-
- name: install uv
574-
uses: astral-sh/setup-uv@v6
575-
with:
576-
version: "0.6.x"
577-
enable-cache: false
578-
cache-dependency-glob: "**/notifications/requirements/ci.txt"
579-
- name: show system version
580-
run: ./ci/helpers/show_system_versions.bash
581-
- name: install
582-
run: ./ci/github/unit-testing/notifications.bash install
583-
- name: typecheck
584-
run: ./ci/github/unit-testing/notifications.bash typecheck
585-
- name: test
586-
if: ${{ !cancelled() }}
587-
run: ./ci/github/unit-testing/notifications.bash test
588-
- uses: codecov/codecov-action@v5
589-
if: ${{ !cancelled() }}
590-
env:
591-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
592-
with:
593-
flags: unittests #optional
554+
uses: ./.github/workflows/_reusable-unit-test.yml
555+
with:
556+
service_name: notifications
557+
timeout_minutes: 18
558+
secrets: inherit
594559

595560
unit-test-api:
596561
needs: changes
597562
if: ${{ needs.changes.outputs.api == 'true' || github.event_name == 'push' || github.event.inputs.force_all_builds == 'true' }}
598-
timeout-minutes: 18 # if this timeout gets too small, then split the tests
599-
name: "[unit] api"
600-
runs-on: ${{ matrix.os }}
601-
strategy:
602-
matrix:
603-
python: ["3.11"]
604-
os: [ubuntu-24.04]
605-
fail-fast: false
606-
steps:
607-
- uses: actions/checkout@v4
608-
- name: setup docker buildx
609-
id: buildx
610-
uses: docker/setup-buildx-action@v3
611-
with:
612-
driver: docker-container
613-
- name: setup python environment
614-
uses: actions/setup-python@v5
615-
with:
616-
python-version: ${{ matrix.python }}
617-
- name: install uv
618-
uses: astral-sh/setup-uv@v6
619-
with:
620-
version: "0.6.x"
621-
enable-cache: false
622-
cache-dependency-glob: "**/api/tests/requirements.txt"
623-
- name: show system version
624-
run: ./ci/helpers/show_system_versions.bash
625-
- name: install api
626-
run: ./ci/github/unit-testing/api.bash install
627-
- name: test
628-
run: ./ci/github/unit-testing/api.bash test
629-
- uses: codecov/codecov-action@v5
630-
if: ${{ !cancelled() }}
631-
env:
632-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
633-
with:
634-
flags: unittests #optional
635-
563+
uses: ./.github/workflows/_reusable-unit-test.yml
564+
with:
565+
service_name: api
566+
timeout_minutes: 18
567+
dependency_path: "**/api/tests/requirements.txt"
568+
secrets: inherit
636569

637570
unit-test-api-server:
638571
needs: changes

0 commit comments

Comments
 (0)