-
Notifications
You must be signed in to change notification settings - Fork 16
137 lines (116 loc) · 5.16 KB
/
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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: test
on:
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
# Notes on this matrix, particularly the dependencies part:
# Hdl21 has two external dependencies: Pydantic and VLSIR.
#
# 1. VLSIR
# This sets up testing with dependencies from both (a) PyPi and (b) "dev" versions from GitHub.
# Not every version of Hdl21 is designed to work with both.
# Eventually this should know which *should* work.
# For now it asserts that the dev-mode passes, and allows failer (`continue-on-error`) for the PyPi version.
#
# 2. Pydantic
# Test with both the minimum supported version, and whatever pip selects, which is generally the latest.
# Some languages/ libraries (ahem, Rust) find a way to build in this "test them min supported version" thing;
# we haven't seen one for Python, and can only really do this "manually" because there is only one.
# Note the combinations pf `python-version` and `pydantic-version` are often relevant;
# typing-stuff generally evolves materially with each python version, and pydantic makes heavy use
# of checking the current interpreter-version to try to make maximally detailed type-checking.
#
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
pydantic-version: ["==1.9.0", ">=2.9"]
dep-installer: ["dev", "pypi"]
# Issues for these:
# VLSIR/ PyPi: https://github.com/dan-fritchman/Hdl21/issues/216
# Python 3.12: https://github.com/dan-fritchman/Hdl21/issues/215
# Python 3.7-3.8: https://github.com/dan-fritchman/Hdl21/issues/217
continue-on-error: ${{ matrix.dep-installer == 'pypi' || matrix.python-version == '3.7'|| matrix.python-version == '3.8' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
bash scripts/install-${{ matrix.dep-installer }}.sh
pip install pydantic${{ matrix.pydantic-version }}
- name: Test with pytest
run: pytest -sv
test_with_sim: # This is the job that runs the simulation tests, and has a much smaller test matrix
runs-on: ubuntu-latest
container: tpluck95/vlsir-test-container
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
pydantic-version: [""]
dep-installer: ["dev", "pypi"]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
run: |
apt update -y && apt upgrade -y
apt install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils
python${{ matrix.python-version }} -m pip install pytest
python${{ matrix.python-version }} -m pip install -Iv black==22.6
- name: pytest `HDL21`
run: |
python${{ matrix.python-version }} -m venv ./venv
. ./venv/bin/activate
bash scripts/install-${{ matrix.dep-installer }}.sh
python${{ matrix.python-version }} -m pip install pydantic${{ matrix.pydantic-version }}
python${{ matrix.python-version }} -m pytest -sv --cov=./ --cov-report=xml
# Seperate jobs for black and codecov, not subject to the dependency matrix
codecov:
runs-on: ubuntu-latest
container: tpluck95/vlsir-test-container
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# This is the same fairly long passage as above, with Python 3.11 and "latest Pydantic" hard-coded.
- name: Set up Python 3.11
run: |
apt update -y && apt upgrade -y
apt install -y python3.11 python3.11-dev python3.11-venv python3.11-distutils
python3.11 -m pip install pytest
python3.11 -m pip install -Iv black==22.6
- name: pytest `HDL21`
run: |
python3.11 -m venv ./venv
. ./venv/bin/activate
bash scripts/install-dev.sh
python3.11 -m pip install pydantic
python3.11 -m pytest -sv --cov=./ --cov-report=xml
- name: Upload coverage to Codecov # Adapted from https://github.com/codecov/codecov-action#usage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
path_to_write_report: ./coverage/codecov_report.txt
verbose: true
black:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Black Formatting Check
uses: psf/black@stable
with:
version: "22.6"
options: "--check --diff --verbose --exclude pdks/PdkTemplate"