test python312 #842
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
container: tpluck95/vlsir-test-container | |
# 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.0", "==2.6", ""] | |
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: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- 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@v3 | |
# 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@v3 | |
- name: Black Formatting Check | |
uses: psf/black@stable | |
with: | |
version: "22.6" | |
options: "--check --diff --verbose --exclude pdks/PdkTemplate" |