-
Notifications
You must be signed in to change notification settings - Fork 30
59 lines (48 loc) · 1.52 KB
/
code_test.yaml
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
name: Code Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12', '3.13']
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
# Set up python versions with matrix to test on multiple versions
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: ct-${{ matrix.python-version}}
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Create virtual environment
run: python -m venv .venv
- name: Activate virtual environment
run: source .venv/bin/activate
# Install all test dependencies
- name: Install dependencies
if: steps.ct-${{ matrix.python-version }}.outputs.cache-hit != 'true'
run: poetry install --only=test --no-interaction --no-root
- name: Run ATS
uses: codecov/codecov-ats@v0
env:
CODECOV_STATIC_TOKEN: ${{ secrets.CODECOV_STATIC_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run tests
run: poetry run pytest --cov app ${{ env.CODECOV_ATS_TESTS }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: smart-tests
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}