Skip to content

Commit 663b0e0

Browse files
committed
chore(ci): align test jobs with mise tasks
Make api-unit-tests and docs-tests use the same mise-action + setup-uv pattern already established by the mypy and typescript-compile jobs in linting-and-checks.yaml, so local `mise run <task>` and CI behave identically. - Add .mise/tasks/test.toml with a test:api:unit task (cd api && uv run pytest --unit; depends on install-dependencies:api). - Rewrite api-unit-tests to use mise-action + setup-uv + mise run test:api:unit. - Rewrite docs-tests to use mise-action + setup-uv + mise run docs:build (existing task); rename misleading 'Checkout GitHub Action' step. - Drop unused CR_SECRET workflow_call input (never referenced; no caller passes it). - Move API_IMAGE env into api-integration-tests job (only consumer); rename dead WEB_IMAGE to NGINX_IMAGE in (currently disabled) web-tests to match the image actually published by publish-image.yaml.
1 parent a10e4d6 commit 663b0e0

2 files changed

Lines changed: 26 additions & 27 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ on:
44
workflow_dispatch:
55
# Workflow call is used for called from another workflow
66
workflow_call:
7-
secrets:
8-
CR_SECRET:
9-
description: "Secret to authenticate if using an other container registry than Github"
10-
required: false
11-
12-
env:
13-
API_IMAGE: ghcr.io/equinor/template-fastapi-react/api
14-
WEB_IMAGE: ghcr.io/equinor/template-fastapi-react/web
157

168
jobs:
179
api-unit-tests:
@@ -20,21 +12,22 @@ jobs:
2012
- name: "Setup: checkout repository"
2113
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2214

15+
- name: "Setup: Runtimes"
16+
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
17+
timeout-minutes: 5
18+
2319
- name: "Setup: install uv"
2420
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
2521
with:
2622
enable-cache: true
2723

28-
- name: "Setup: install dependencies"
29-
working-directory: ./api
30-
run: uv sync --locked
31-
3224
- name: "Run: pytest unit tests"
33-
working-directory: ./api
34-
run: uv run pytest --unit
25+
run: mise run test:api:unit
3526

3627
api-integration-tests:
3728
runs-on: ubuntu-latest
29+
env:
30+
API_IMAGE: ghcr.io/equinor/template-fastapi-react/api
3831
steps:
3932
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4033

@@ -59,6 +52,8 @@ jobs:
5952
web-tests:
6053
runs-on: ubuntu-latest
6154
if: ${{ false }} # disable for now as they do not currently work
55+
env:
56+
NGINX_IMAGE: ghcr.io/equinor/template-fastapi-react/nginx
6257
steps:
6358
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6459

@@ -71,8 +66,8 @@ jobs:
7166

7267
- name: Build Web Image
7368
run: |
74-
docker pull $WEB_IMAGE
75-
docker build --cache-from $WEB_IMAGE --target development --tag web-dev ./web
69+
docker pull $NGINX_IMAGE
70+
docker build --cache-from $NGINX_IMAGE --target development --tag web-dev ./web
7671
7772
- name: Run Web tests
7873
if: ${{ false }} # disable for now as they do not currently work
@@ -83,18 +78,17 @@ jobs:
8378
runs-on: ubuntu-latest
8479

8580
steps:
86-
# If you know your docs does not rely on anything outside of the documentation folder, the commented out code below can be used to only test the docs build if the documentation folder changes.
87-
- name: Checkout GitHub Action
81+
- name: "Setup: checkout repository"
8882
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
89-
# with:
90-
# fetch-depth: 0
9183

92-
- name: Install uv
84+
- name: "Setup: Runtimes"
85+
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
86+
timeout-minutes: 5
87+
88+
- name: "Setup: install uv"
9389
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
90+
with:
91+
enable-cache: true
9492

95-
- name: Install dependencies and build website
96-
# if: steps.docs-changes.outputs.changes > 0
97-
run: |
98-
cd docs
99-
uv sync --locked
100-
uv run zensical build
93+
- name: "Run: build docs site"
94+
run: mise run docs:build

.mise/tasks/test.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
["test:api:unit"]
2+
description = "Run the API unit tests"
3+
depends = ["install-dependencies:api"]
4+
dir = "{{config_root}}/api"
5+
run = "uv run pytest --unit"

0 commit comments

Comments
 (0)