Add Spell Checker #820
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: Checks | |
on: | |
push: | |
branches: | |
- master | |
- '*_rel' | |
repository_dispatch: | |
# to run this, send a POST API call at repos/<user>/<repo>/dispatches with the specified event_type | |
# e.g. `gh repos/CCSI-Toolset/FOQUS/dispatches -F event_type=ci_run_tests` | |
types: [ci_run_tests] | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
# ready_for_review occurs when a draft PR is turned to non-draft | |
- ready_for_review | |
# synchronize occurs whenever commits are pushed to the PR branch | |
- synchronize | |
defaults: | |
run: | |
# the -l flag is needed for the Conda environment to be activated properly | |
shell: bash -l {0} | |
env: | |
FOQUS_CONDA_ENV_NAME_DEV: ccsi-foqus-dev | |
PYTEST_BASETEMP: .pytest | |
jobs: | |
code-formatting: | |
name: Code formatting (Black) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install Black | |
# unlike the other jobs, we don't need to install FOQUS and/or all the dev dependencies, | |
# but we still want to specify the Black version to use in requirements-dev.txt for local development | |
# so we extract the relevant line and pass it to a simple `pip install` | |
run: | | |
# we store the version | |
black_requirement="$(grep '^black.*$' requirements-dev.txt)" | |
pip --no-cache-dir install --progress-bar off "$black_requirement" | |
- name: Run Black to verify that the committed code is formatted | |
run: | | |
black --check . | |
spell-check: | |
name: Check Spelling | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Run Spell Checker | |
uses: crate-ci/typos@master | |
with: | |
config: ./.github/workflows/typos.toml | |
pytest: | |
name: pytest (py${{ matrix.python-version }}/${{ matrix.os }}) | |
needs: [code-formatting, spell-check] | |
runs-on: ${{ matrix.os-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- '3.7' | |
- '3.8' | |
- '3.9' | |
# - '3.10' | |
os: | |
- linux | |
- win64 | |
- macos | |
include: | |
- os: macos | |
os-version: macos-12 | |
- os: linux | |
os-version: ubuntu-20.04 | |
- os: win64 | |
os-version: windows-2019 | |
- python-version: "3.8" # avoid uploading coverage for full matrix | |
use_coverage: true | |
- python-version: "3.8" # this is to avoid installing optional dependencies in all environments | |
optional-dependencies: tensorflow sympy torch scikit-learn | |
env: | |
# uncomment this to debug Qt initialization errors | |
# QT_DEBUG_PLUGINS: '1' | |
MPLBACKEND: AGG | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: ${{ env.FOQUS_CONDA_ENV_NAME_DEV }} | |
python-version: ${{ matrix.python-version }} | |
- name: Set up FOQUS | |
uses: ./.github/actions/setup-foqus | |
with: | |
pip-install-target: -r requirements-dev.txt ${{ matrix.optional-dependencies }} | |
- name: Set common pytest flags | |
run: | |
echo 'PYTEST_ADDOPTS=--pyargs foqus_lib --verbose --color=yes --basetemp "${{ env.PYTEST_BASETEMP }}"' >> $GITHUB_ENV | |
- name: Set up GUI test environment (Linux) | |
if: contains(matrix.os, 'linux') | |
run: | | |
echo "QT_QPA_PLATFORM=minimal" >> $GITHUB_ENV | |
- name: Run pytest (default options) | |
if: "! matrix.use_coverage" | |
run: | | |
pytest foqus_lib/ | |
- name: Run pytest (coverage) | |
if: matrix.use_coverage | |
run: | | |
pytest foqus_lib/ --cov=./ --cov-report=xml --cov-report=term | |
- name: Upload pytest artifacts | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
# TODO decide if we need a separate upload for each Python version | |
name: pytest-dir-${{ matrix.os }}-py${{ matrix.python-version }} | |
path: ${{ env.PYTEST_BASETEMP }} | |
retention-days: 7 | |
- name: Upload coverage report to Codecov | |
if: matrix.use_coverage | |
uses: codecov/codecov-action@v2 | |
pylint: | |
name: pylint (py${{ matrix.python-version }}) | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- '3.7' | |
- '3.8' | |
- '3.9' | |
# - '3.10' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: ${{ env.FOQUS_CONDA_ENV_NAME_DEV }} | |
python-version: ${{ matrix.python-version }} | |
- name: Set up FOQUS | |
uses: ./.github/actions/setup-foqus | |
with: | |
pip-install-target: -r requirements-dev.txt | |
- name: Run pylint | |
run: | | |
pylint --rcfile=.pylint/pylintrc --disable=W,C,R,I foqus_lib/ | |
docs: | |
name: Build docs | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: ${{ env.FOQUS_CONDA_ENV_NAME_DEV }} | |
python-version: ${{ matrix.python-version }} | |
- name: Set up FOQUS | |
uses: ./.github/actions/setup-foqus | |
with: | |
pip-install-target: -r requirements-dev.txt | |
- name: Build docs | |
run: | | |
cd docs/ | |
make CLOPTS="-qW --keep-going" clean dummy |