Repository navigation
118 lines (109 loc) · 4.09 KB
/
Copy pathpython_tests.yml
File metadata and controls
118 lines (109 loc) · 4.09 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python Tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "**" ]
workflow_call:
permissions:
contents: read
# The group is named literally because in a workflow that release.yml calls,
# github.workflow is the caller's name. vhdl_sim.yml would then share the group,
# and the two would cancel each other.
concurrency:
group: python-tests-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
# setup-python has no Python 3.9 build for ubuntu-latest (26.04).
runs-on: ubuntu-24.04
# Experimental (pre-release) Python versions may fail without failing CI.
continue-on-error: ${{ matrix.experimental || false }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
include:
# Bleeding edge: test the next Python while it is still in pre-release.
- python-version: "3.15"
experimental: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
- name: Run type checking with mypy
run: |
mypy bust
- name: Run tests with coverage
run: |
pytest --cov=bust --cov-report=term-missing --cov-report=xml --cov-fail-under=60
- name: Coverage summary
if: matrix.python-version == '3.11'
run: |
{
echo '### Coverage report'
echo '```'
coverage report
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
- run: pip install -e ".[docs]"
- name: Build the documentation site
run: sphinx-build -W --keep-going -b html docs docs/_build/html
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.11"
- run: pip install build twine
- name: Build sdist + wheel
run: python -m build
- name: Check artifacts
run: twine check dist/*
- name: Smoke-test the built wheel
run: |
python -m venv "$RUNNER_TEMP/wheel-venv"
"$RUNNER_TEMP/wheel-venv/bin/pip" install dist/*.whl
# -I keeps the checkout off sys.path, so this reads the installed package.
version="$("$RUNNER_TEMP/wheel-venv/bin/python" -I -c 'from bust._version import __VERSION__; print(__VERSION__)')"
PATH="$RUNNER_TEMP/wheel-venv/bin:$PATH" scripts/smoke-test.sh "$version"
# cloudbust runs bust in the browser. Install the wheel in Pyodide with only
# the core dependencies and check that it writes what CPython writes.
- name: Generate the examples with CPython
env:
SOURCE_DATE_EPOCH: 0
run: |
for example in example/*.json; do
"$RUNNER_TEMP/wheel-venv/bin/bust" "$example" -o "$RUNNER_TEMP/cpython" -p
done
- name: Generate the examples with Pyodide
working-directory: scripts/pyodide
env:
SOURCE_DATE_EPOCH: 0
run: |
npm ci
node run.mjs ../../dist/*.whl "$RUNNER_TEMP/pyodide"
- name: Compare
run: diff -r "$RUNNER_TEMP/cpython" "$RUNNER_TEMP/pyodide"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist
path: dist/*