-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 1.67 KB
/
backend_ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Backend CI
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# When this action will be executed
on:
# Automatically trigger it when detected changes in repo
push:
branches:
- main
paths:
- "api/**"
- ".github/workflows/backend_ci.yml"
pull_request:
branches:
- main
paths:
- "api/**"
- ".github/workflows/backend_ci.yml"
# Allow manual trigger
workflow_dispatch:
permissions:
contents: read
issues: read
checks: write
pull-requests: write
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Define a cache for the virtual environment based on the dependencies lock file
uses: actions/cache@v3
with:
path: ./api/.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
working-directory: api
run: poetry install --with=dev
- name: Run Pytest
working-directory: api
run: poetry run pytest tests/ --junit-xml=test-results.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
api/test-results.xml