ENH: Adopt PEP518 and PEP631 #325
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, package | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
# max-parallel: 6 | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
requires: ['minimal', 'latest'] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set min. dependencies | |
if: matrix.requires == 'minimal' | |
run: | | |
python -c "req = open('pyproject.toml').read().replace(' >= ', ' == ') ; open('pyproject.toml', 'w').write(req)" | |
# - name: Cache pip | |
# uses: actions/cache@v2 | |
# id: cache | |
# with: | |
# path: ${{ env.pythonLocation }} | |
# # Look to see if there is a cache hit for the corresponding requirements files | |
# key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/*') }} | |
# restore-keys: | | |
# ${{ env.pythonLocation }}- | |
- name: Install dependencies | |
# if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
# SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL required due to | |
# some dependency listing "scikit-learn" as "sklearn" in its dependencies | |
export SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True | |
python -m pip install --upgrade --user pip | |
pip install setuptools tox | |
pip install -e .[test] | |
python --version | |
pip --version | |
pip list | |
- name: Run tests | |
run: | | |
# Test with tox | |
tox --sitepackages | |
# Test with pytest | |
python -c 'import whitematteranalysis' | |
coverage run --source whitematteranalysis -m pytest -o junit_family=xunit2 -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml | |
# coverage run --source whitematteranalysis -m pytest -o junit_family=xunit2 -v --doctest-modules --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@master | |
with: | |
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }} | |
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml | |
# Use always() to always run this step to publish test results when there are test failures | |
if: always() | |
- name: Statistics | |
if: success() | |
run: | | |
coverage report | |
- name: Package Setup | |
# - name: Run tests with tox | |
run: | | |
pip install build | |
# check-manifest | |
python -m build | |
# twine check dist/ | |
# tox --sitepackages | |
# python -m tox |