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 }}'
|
continue-on-error: '${{ matrix.allow-failure }}'
|
||||||
name: 'test (${{ matrix.python-version }})'
|
name: 'test (${{ matrix.python-version }})'
|
||||||
steps:
|
steps:
|
||||||
|
- name: Preserve Wasm cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/wasmtime
|
||||||
|
~/.cache/YoWASP
|
||||||
|
key: ${{ runner.os }}-wasm
|
||||||
- name: Check out source code
|
- name: Check out source code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Set up Python
|
- name: Set up PDM
|
||||||
uses: actions/setup-python@v4
|
uses: pdm-project/setup-pdm@v3
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install dependencies
|
- 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 add-apt-repository 'deb http://ppa.launchpad.net/sri-csl/formal-methods/ubuntu bionic main'
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install yices2
|
sudo apt-get install yices2
|
||||||
pip install coverage codecov
|
pip install codecov yowasp-yosys
|
||||||
pip install yowasp-yosys
|
pdm install --dev
|
||||||
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
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
env:
|
||||||
|
YOSYS: yowasp-yosys
|
||||||
|
NEXTPNR_ICE40: yowasp-nextpnr-ice40
|
||||||
|
ICEPACK: yowasp-icepack
|
||||||
|
SBY: yowasp-sby
|
||||||
|
SMTBMC: yowasp-yosys-smtbmc
|
||||||
run: |
|
run: |
|
||||||
export AMARANTH_USE_YOSYS=builtin YOSYS=yowasp-yosys SBY=yowasp-sby SMTBMC=yowasp-yosys-smtbmc
|
pdm run test
|
||||||
export PYTHONWARNINGS=error
|
- name: Submit code coverage
|
||||||
python -m coverage run -m unittest discover -t . -s tests
|
run:
|
||||||
unset PYTHONWARNINGS
|
|
||||||
sphinx-build -b doctest docs/ docs/_build
|
|
||||||
codecov
|
codecov
|
||||||
|
|
||||||
document:
|
document:
|
||||||
|
@ -69,17 +71,16 @@ jobs:
|
||||||
- name: Fetch tags from upstream repository
|
- name: Fetch tags from upstream repository
|
||||||
run: |
|
run: |
|
||||||
git fetch --tags https://github.com/amaranth-lang/amaranth.git
|
git fetch --tags https://github.com/amaranth-lang/amaranth.git
|
||||||
- name: Set up Python
|
- name: Set up PDM
|
||||||
uses: actions/setup-python@v4
|
uses: pdm-project/setup-pdm@v3
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -r docs/requirements.txt
|
pdm install --dev
|
||||||
pip install .
|
|
||||||
- name: Build documentation
|
- name: Build documentation
|
||||||
run: |
|
run: |
|
||||||
sphinx-build docs docs/_build
|
pdm run document
|
||||||
- name: Upload documentation archive
|
- name: Upload documentation archive
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
sphinx~=5.3
|
|
||||||
sphinxcontrib-platformpicker~=1.3
|
|
||||||
sphinx-rtd-theme~=1.2
|
|
|
@ -1,6 +1,4 @@
|
||||||
[build-system]
|
# Project metadata
|
||||||
requires = ["wheel", "setuptools>=67.0", "setuptools_scm[toml]>=6.2"]
|
|
||||||
build-backend = "setuptools.build_meta"
|
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
dynamic = ["version", "urls"]
|
dynamic = ["version", "urls"]
|
||||||
|
@ -25,6 +23,12 @@ remote-build = ["paramiko~=2.7"]
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
amaranth-rpc = "amaranth.rpc:main"
|
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]
|
[tool.setuptools]
|
||||||
# If amaranth 0.3 is checked out with git (e.g. as a part of a persistent editable install or
|
# 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,
|
# 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]
|
[tool.setuptools_scm]
|
||||||
local_scheme = "node-and-timestamp"
|
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