Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 21 additions & 27 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,34 @@ on:
workflow_dispatch:
# Workflow call is used for called from another workflow
workflow_call:
secrets:
CR_SECRET:
description: "Secret to authenticate if using an other container registry than Github"
required: false

permissions:
contents: read
packages: read

env:
API_IMAGE: ghcr.io/equinor/template-fastapi-react/api
WEB_IMAGE: ghcr.io/equinor/template-fastapi-react/web

jobs:
api-unit-tests:
runs-on: ubuntu-latest
steps:
- name: "Setup: checkout repository"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: "Setup: Runtimes"
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
timeout-minutes: 5

- name: "Setup: install uv"
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true

- name: "Setup: install dependencies"
working-directory: ./api
run: uv sync --locked

- name: "Run: pytest unit tests"
working-directory: ./api
run: uv run pytest --unit
run: mise run test:api:unit

api-integration-tests:
runs-on: ubuntu-latest
env:
API_IMAGE: ghcr.io/equinor/template-fastapi-react/api
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

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

Expand All @@ -75,8 +70,8 @@ jobs:

- name: Build Web Image
run: |
docker pull $WEB_IMAGE
docker build --cache-from $WEB_IMAGE --target development --tag web-dev ./web
docker pull $NGINX_IMAGE
docker build --cache-from $NGINX_IMAGE --target development --tag web-dev ./web

- name: Run Web tests
if: ${{ false }} # disable for now as they do not currently work
Expand All @@ -87,18 +82,17 @@ jobs:
runs-on: ubuntu-latest

steps:
# 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.
- name: Checkout GitHub Action
- name: "Setup: checkout repository"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# fetch-depth: 0

- name: Install uv
- name: "Setup: Runtimes"
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
timeout-minutes: 5

- name: "Setup: install uv"
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true

- name: Install dependencies and build website
# if: steps.docs-changes.outputs.changes > 0
run: |
cd docs
uv sync --locked
uv run zensical build
- name: "Run: build docs site"
run: mise run docs:build
5 changes: 5 additions & 0 deletions .mise/tasks/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
["test:api:unit"]
description = "Run the API unit tests"
depends = ["install-dependencies:api"]
dir = "{{config_root}}/api"
run = "uv run pytest --unit"
Loading