pypardiso-tests #1210
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: pypardiso-tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
# Run the tests once every 24 hours to catch dependency problems early | |
- cron: '0 7 * * *' | |
jobs: | |
generate-requirement-files: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: create empty environment.yml | |
run: | | |
cat > environment.yml <<EOF | |
name: pypardiso | |
channels: | |
- conda-forge | |
dependencies: | |
EOF | |
- name: generate requirements | |
uses: mikefarah/yq@master | |
with: | |
cmd: | | |
yq '.project.dependencies' pyproject.toml -oy > reqs.yml | |
cat reqs.yml >> environment.yml | |
yq '.[]' reqs.yml > requirements.txt | |
- name: Show requirement files | |
run: | | |
cat environment.yml | |
echo | |
cat requirements.txt | |
- name: Upload environment.yml | |
uses: actions/upload-artifact@v3 | |
with: | |
name: environment.yml | |
path: environment.yml | |
- name: Upload requirements.txt | |
uses: actions/upload-artifact@v3 | |
with: | |
name: requirements.txt | |
path: requirements.txt | |
conda-tests: | |
runs-on: ${{ matrix.os }} | |
needs: generate-requirement-files | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: environment.yml | |
- name: Set up miniconda with python ${{ matrix.python-version }} | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
activate-environment: test | |
environment-file: environment.yml | |
auto-activate-base: false | |
- name: Conda env info | |
shell: bash -l {0} | |
run: | | |
conda list | |
conda env export | |
- name: Lint with flake8 | |
shell: bash -l {0} | |
run: | | |
conda install flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
id: tests | |
continue-on-error: true | |
shell: bash -l {0} | |
run: | | |
conda install pytest | |
python -m pytest | |
- name: invert failure | |
if: ${{ steps.tests.outcome != 'success' && matrix.os == 'windows-latest' }} | |
run: exit 0 | |
- name: invert success | |
if: ${{ steps.tests.outcome == 'success' && matrix.os == 'windows-latest' }} | |
run: exit 1 | |
pip-tests: | |
runs-on: ${{ matrix.os }} | |
needs: generate-requirement-files | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: requirements.txt | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install pytest | |
- name: Test with pytest | |
run: | | |
python -m pytest |