update workflow versions (#362) #400
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: pytest-py38-mindeps | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8.14' #used at HMC | |
- name: Set fixed versions in requirements.txt extracted from pyproject.toml | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install "toml-to-requirements==0.1.0" # highest version available to py38 | |
toml-to-req --toml-file pyproject.toml --include-optional # --optional-lists dev # commented arg is available from toml-to-requirements 0.2.0, but that version is not available for py38. | |
sed -i -E 's/>=/==/' requirements.txt | |
# temporarily removing all non-dev optional requirements manually, can be done more cleanly with toml-to-req>=0.2.0 | |
sed -i '/^sphinx/d' requirements.txt | |
sed -i '/^nbsphinx/d' requirements.txt | |
sed -i '/^pydata-sphinx-theme/d' requirements.txt | |
sed -i '/^jupyter/d' requirements.txt | |
sed -i '/^notebook/d' requirements.txt | |
- name: Print contents of requirements.txt | |
run: | | |
# print file contents | |
cat requirements.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
# also install the package itself to enable subprocess to work properly (for cli) | |
python -m pip install -e . | |
- name: list env contents | |
run: | | |
conda info | |
conda list | |
pip list | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
run: | | |
pytest -m "not acceptance" --cov=hatyan --cov-report xml --cov-report term |