-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (53 loc) · 1.92 KB
/
build-python.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
60
61
62
63
64
65
name: Build, Test and Publish Python
on: [workflow_call]
jobs:
build-python:
strategy:
matrix:
os: ["ubuntu-latest"]
python: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install pipx
run: |
python -m pip install --upgrade pip
python -m pip install pipx
python -m pipx ensurepath
- name: Cache Poetry
uses: actions/cache@v4
with:
path: ~/.local/share/pipx/venvs/poetry
key: ${{ runner.os }}-poetry-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python }}-
- name: Install poetry
run: pipx install poetry
- name: Install dependencies
run: poetry install --no-interaction
- name: Start LocalNet
shell: bash
run: |
pipx install algokit
algokit -v localnet start
sleep 10 # workaround for slow startup
- name: pytest + coverage
shell: bash
run: poetry run pytest -n auto --junitxml=pytest-junit.xml --cov-report=term-missing:skip-covered --cov=src | tee pytest-coverage.txt
- name: Stop LocalNet
shell: bash
run: algokit localnet stop
- name: pytest coverage comment - using Python 3.10 on ubuntu-latest
if: matrix.python == '3.10' && matrix.os == 'ubuntu-latest'
uses: MishaKav/pytest-coverage-comment@main
continue-on-error: true # forks fail to add a comment, so continue any way
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest-junit.xml
- name: Build Wheel
run: poetry build --format wheel