-
Notifications
You must be signed in to change notification settings - Fork 68
77 lines (65 loc) · 2.85 KB
/
build-python.yaml
File metadata and controls
77 lines (65 loc) · 2.85 KB
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
69
70
71
72
73
74
75
76
77
name: Build, Test and Publish Python
on: [workflow_call]
jobs:
build-python:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Poetry
uses: ./.github/actions/setup-poetry
- name: Install dependencies
# TODO: remove fixed pipx dependency once 3.12 compatibility is addressed
# track here -> https://github.com/crytic/tealer/pull/209
run: poetry install --no-interaction --without docs && pipx install tealer==0.1.2
- name: Install PuyaPy
if: ${{ matrix.python == '3.12' }}
run: pipx install puyapy
- name: pytest
shell: bash
if: ${{ !(matrix.python == '3.12' && matrix.os == 'ubuntu-latest') }}
# git config is needed due to several tests relying on e2e copier invocation and copier relies on git during `copy` command
run: |
set -o pipefail
git config --global user.email "actions@github.com" && git config --global user.name "github-actions"
poetry run pytest -n auto
id: pytest
- name: pytest + coverage
shell: bash
if: matrix.python == '3.12' && matrix.os == 'ubuntu-latest'
env:
COVERAGE_CORE: sysmon
# git config is needed due to several tests relying on e2e copier invocation and copier relies on git during `copy` command
run: |
set -o pipefail
git config --global user.email "actions@github.com" && git config --global user.name "github-actions"
poetry run pytest -n auto --junitxml=pytest-junit.xml --cov-report=term-missing:skip-covered --cov=src | tee pytest-coverage.txt
id: pytest-cov
- name: Upload received snapshots (in case of failure)
if: failure() && (steps.pytest.outcome == 'failure' || steps.pytest-cov.outcome == 'failure')
uses: actions/upload-artifact@v4
with:
name: test-artifacts-${{ matrix.os }}-python${{ matrix.python }}
path: tests/**/*.received.txt
- name: pytest coverage comment - using Python 3.12 on ubuntu-latest
if: matrix.python == '3.12' && matrix.os == 'ubuntu-latest'
continue-on-error: true # forks fail to add a comment, so continue any way
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest-junit.xml
- name: Build Wheel
run: poetry build --format wheel