Repository navigation
82 lines (76 loc) · 2.7 KB
/
Copy pathpython-app.yml
File metadata and controls
82 lines (76 loc) · 2.7 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
# Tests. Branch protection on master requires the job named "build"; keep that name.
name: BindsNET build status
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
POETRY_VERSION: "2.4.3"
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Poetry
run: pipx install "poetry==${POETRY_VERSION}"
- uses: actions/setup-python@v7
with:
python-version: "3.13"
cache: poetry
- name: Install dependencies
run: |
poetry install
.github/scripts/use_cpu_torch.sh "poetry run python"
- name: Show CPU (golden files depend on pinned maths paths; test/regression/cpu_pins.py)
run: |
grep -m1 "model name" /proc/cpuinfo
if grep -qw avx512f /proc/cpuinfo; then echo "AVX-512 yes"; else echo "AVX-512 no"; fi
- name: Lint with flake8 (syntax errors and undefined names)
run: pipx run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Test with pytest (with coverage)
# -c and --cov-config pin the settings to pyproject.toml, so an added
# pytest.ini, setup.cfg, tox.ini or .coveragerc cannot change what runs.
run: >
poetry run pytest -c pyproject.toml --cov-config=pyproject.toml
--cov=bindsnet --cov-report=term --cov-report=xml
# A floor, not a target: fails only when coverage of the core packages drops
# below the value recorded in the script (see its docstring).
- name: Check coverage floor
run: python .github/scripts/coverage_floor.py coverage.xml
- uses: actions/upload-artifact@v7
with:
name: coverage-xml
path: coverage.xml
# The other supported Python versions (pyproject.toml: >=3.11,<3.14).
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v7
- name: Install Poetry
run: pipx install "poetry==${POETRY_VERSION}"
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies
run: |
poetry install
.github/scripts/use_cpu_torch.sh "poetry run python"
- name: Show CPU (golden files depend on pinned maths paths; test/regression/cpu_pins.py)
run: |
grep -m1 "model name" /proc/cpuinfo
if grep -qw avx512f /proc/cpuinfo; then echo "AVX-512 yes"; else echo "AVX-512 no"; fi
- name: Test with pytest
run: poetry run pytest -c pyproject.toml