Adding CI #4
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: PyLECO CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
docs_lint: | |
name: Docs and Linting | |
runs-on: "ubuntu-latest" | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache conda | |
uses: actions/cache@v3 | |
env: | |
CACHE_NUMBER: 0 # Increase to reset the cache | |
with: | |
path: ~/conda_pkgs_dir | |
key: py3.10-ubuntu-latest-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} | |
- name: Install pyleco requirements | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: "3.10" | |
environment-file: environment.yml | |
activate-environment: pyleco | |
auto-update-conda: true | |
use-only-tar-bz2: true # for caching to work properly | |
- name: Conda info & list | |
run: | | |
conda info | |
conda list | |
- name: Set up flake8 annotations | |
uses: rbialon/flake8-annotations@v1 | |
- name: Lint with flake8 | |
run: | | |
# Be sure to check for Python syntax errors or undefined names | |
flake8 . --count --extend-select=E9,F63,F7,F82 --show-source --statistics | |
- uses: ammaraskar/sphinx-problem-matcher@master | |
- name: Generate docs | |
if: always() # run even if the previous step failed | |
working-directory: ./docs | |
run: | | |
echo "::add-matcher::.github/sphinx.json" | |
make html SPHINXOPTS="-W --keep-going" | |
- name: Run doctests | |
if: always() # run even if the previous step failed | |
working-directory: ./docs | |
run: | | |
echo "::add-matcher::.github/sphinx.json" | |
make doctest SPHINXOPTS="-W --keep-going" | |
test: | |
name: Python ${{ matrix.python-version }}, ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache conda | |
uses: actions/cache@v3 | |
env: | |
CACHE_NUMBER: 0 # Increase to reset the cache | |
with: | |
path: ~/conda_pkgs_dir | |
key: py${{ matrix.python-version }}-${{ matrix.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} | |
- name: Install pyleco requirements | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
environment-file: environment.yml | |
activate-environment: pyleco | |
auto-update-conda: true | |
use-only-tar-bz2: true # for caching to work properly | |
- name: Install Pyleco | |
# If the pytest problem matcher stops working because of bad paths, do an editable install | |
run: pip install .[tests] | |
- name: Pyleco version | |
run: python -c "import pyleco;print(pyleco.__version__)" | |
- name: Conda info & list | |
run: | | |
conda info | |
conda list | |
- name: Run pytest with xvfb | |
if: runner.os == 'Linux' | |
run: | | |
echo "::add-matcher::.github/pytest.json" | |
xvfb-run -a pytest | |
- name: Run pytest | |
if: runner.os != 'Linux' | |
run: | | |
echo "::add-matcher::.github/pytest.json" | |
pytest |