Formalize test and documentation workflows using PDM.
This commit is contained in:
parent
d491288e32
commit
1826fa83bd
47
.github/workflows/main.yaml
vendored
47
.github/workflows/main.yaml
vendored
|
@ -25,12 +25,19 @@ jobs:
|
|||
continue-on-error: '${{ matrix.allow-failure }}'
|
||||
name: 'test (${{ matrix.python-version }})'
|
||||
steps:
|
||||
- name: Preserve Wasm cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/wasmtime
|
||||
~/.cache/YoWASP
|
||||
key: ${{ runner.os }}-wasm
|
||||
- name: Check out source code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
- name: Set up PDM
|
||||
uses: pdm-project/setup-pdm@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
|
@ -39,24 +46,19 @@ jobs:
|
|||
sudo add-apt-repository 'deb http://ppa.launchpad.net/sri-csl/formal-methods/ubuntu bionic main'
|
||||
sudo apt-get update
|
||||
sudo apt-get install yices2
|
||||
pip install coverage codecov
|
||||
pip install yowasp-yosys
|
||||
pip install -e .[builtin-yosys]
|
||||
pip install -r docs/requirements.txt
|
||||
- name: Preserve Wasm cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/wasmtime
|
||||
~/.cache/YoWASP
|
||||
key: ${{ runner.os }}-wasm
|
||||
pip install codecov yowasp-yosys
|
||||
pdm install --dev
|
||||
- name: Run tests
|
||||
env:
|
||||
YOSYS: yowasp-yosys
|
||||
NEXTPNR_ICE40: yowasp-nextpnr-ice40
|
||||
ICEPACK: yowasp-icepack
|
||||
SBY: yowasp-sby
|
||||
SMTBMC: yowasp-yosys-smtbmc
|
||||
run: |
|
||||
export AMARANTH_USE_YOSYS=builtin YOSYS=yowasp-yosys SBY=yowasp-sby SMTBMC=yowasp-yosys-smtbmc
|
||||
export PYTHONWARNINGS=error
|
||||
python -m coverage run -m unittest discover -t . -s tests
|
||||
unset PYTHONWARNINGS
|
||||
sphinx-build -b doctest docs/ docs/_build
|
||||
pdm run test
|
||||
- name: Submit code coverage
|
||||
run:
|
||||
codecov
|
||||
|
||||
document:
|
||||
|
@ -69,17 +71,16 @@ jobs:
|
|||
- name: Fetch tags from upstream repository
|
||||
run: |
|
||||
git fetch --tags https://github.com/amaranth-lang/amaranth.git
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
- name: Set up PDM
|
||||
uses: pdm-project/setup-pdm@v3
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -r docs/requirements.txt
|
||||
pip install .
|
||||
pdm install --dev
|
||||
- name: Build documentation
|
||||
run: |
|
||||
sphinx-build docs docs/_build
|
||||
pdm run document
|
||||
- name: Upload documentation archive
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
sphinx~=5.3
|
||||
sphinxcontrib-platformpicker~=1.3
|
||||
sphinx-rtd-theme~=1.2
|
|
@ -1,6 +1,4 @@
|
|||
[build-system]
|
||||
requires = ["wheel", "setuptools>=67.0", "setuptools_scm[toml]>=6.2"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
# Project metadata
|
||||
|
||||
[project]
|
||||
dynamic = ["version", "urls"]
|
||||
|
@ -25,6 +23,12 @@ remote-build = ["paramiko~=2.7"]
|
|||
[project.scripts]
|
||||
amaranth-rpc = "amaranth.rpc:main"
|
||||
|
||||
# Build system configuration
|
||||
|
||||
[build-system]
|
||||
requires = ["wheel", "setuptools>=67.0", "setuptools_scm[toml]>=6.2"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools]
|
||||
# If amaranth 0.3 is checked out with git (e.g. as a part of a persistent editable install or
|
||||
# a git worktree cached by tools like poetry), it can have an empty `nmigen` directory left over,
|
||||
|
@ -34,3 +38,25 @@ packages = ["amaranth"]
|
|||
|
||||
[tool.setuptools_scm]
|
||||
local_scheme = "node-and-timestamp"
|
||||
|
||||
# Development workflow configuration
|
||||
|
||||
[tool.pdm.dev-dependencies]
|
||||
test = [
|
||||
"coverage",
|
||||
]
|
||||
docs = [
|
||||
"sphinx~=5.3",
|
||||
"sphinxcontrib-platformpicker~=1.3",
|
||||
"sphinx-rtd-theme~=1.2",
|
||||
"sphinx-autobuild",
|
||||
]
|
||||
|
||||
[tool.pdm.scripts]
|
||||
test.composite = ["test-code", "test-docs"]
|
||||
test-code.env = {PYTHONWARNINGS = "error"}
|
||||
test-code.cmd = "python -m coverage run -m unittest discover -t . -s tests -v"
|
||||
test-docs.cmd = "sphinx-build -b doctest docs/ docs/_build"
|
||||
|
||||
document.cmd = "sphinx-build docs/ docs/_build/"
|
||||
document-live.cmd = "sphinx-autobuild docs/ docs/_build/ --watch amaranth"
|
||||
|
|
Loading…
Reference in a new issue