test with install from wheel, instead of from source #74
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
name: Test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build-wheel: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: test package before building wheel | |
run: | | |
python -m pip install numpy pyparsing pytest pytest-cov | |
pytest -v | |
- name: build wheel | |
run: | | |
python -m pip install build | |
python -m build | |
- name: upload wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheel | |
path: dist/*.whl | |
check-docs-build: | |
runs-on: ubuntu-latest | |
needs: build-wheel | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies for building docs | |
run: | | |
python -m pip install -e .[dev] | |
python -m pip install numpy scipy matplotlib sphinx | |
- name: check that the docs build | |
run: | | |
make -j 4 -C doc/sphinx SPHINXOPTS="-W --keep-going" html | |
# Test the wheel on different platforms | |
test: | |
runs-on: ${{ matrix.cfg.os }} | |
needs: build-wheel | |
strategy: | |
matrix: | |
cfg: | |
#- { os: ubuntu-20.04, py: 2.7 } | |
#- { os: ubuntu-20.04, py: 3.6 } | |
- { os: ubuntu-latest, py: 3.8 } | |
- { os: ubuntu-latest, py: 3.11, doc: 1 } | |
- { os: windows-latest, py: 3.11 } | |
- { os: macos-latest, py: 3.11 } | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.cfg.py }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.cfg.py }} | |
- name: Download the wheel | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheel | |
path: dist | |
- name: Install the wheel for Windows configuration | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
$wheel = Get-ChildItem -Path dist -Filter "periodictable*.whl" | Select-Object -First 1 | |
python -m pip install $wheel.FullName | |
shell: pwsh | |
- name: Install the wheel for configurations other than Windows | |
if: ${{ runner.os != 'Windows' }} | |
run: python -m pip install dist/periodictable*.whl | |
- name: Install Python dependencies | |
run: | | |
python -m pip install pytest pytest-cov | |
# Change into the test directory to test the wheel so that the | |
# source directory is not on the path. Full tests with coverage are | |
# run before building the wheel. | |
- name: Test wheel with pytest | |
run: | | |
cd test | |
pytest -v --pyargs --import-mode=append periodictable . ../doc/sphinx/guide |