Skip to content

Add non-technical documentation to PRIMO website (#34) #1

Add non-technical documentation to PRIMO website (#34)

Add non-technical documentation to PRIMO website (#34) #1

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Checks
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
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:
# needed for colorized output to be shown in GHA logs
PYTEST_ADDOPTS: "--color=yes"
PIP_PROGRESS_BAR: "off"
BING_API_KEY: ${{ secrets.BING_API_KEY }}
CENSUS_KEY: ${{ secrets.CENSUS_KEY }}
jobs:
pytest:
name: Tests (py${{ matrix.python-version }}/${{ matrix.os }}/${{ matrix.install-mode }})
runs-on: ${{ matrix.os-version }}
strategy:
fail-fast: false
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
os:
- linux
- win64
install-mode:
- dev
include:
- os: linux
os-version: ubuntu-latest
- os: win64
os-version: windows-latest
- install-mode: dev
pip-install-target: -r requirements-dev.txt
- install-mode: dev
python-version: '3.9'
os: linux
cov-report: true
steps:
- uses: actions/checkout@v4
if: matrix.install-mode == 'dev'
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up package (install-mode=${{ matrix.install-mode }})
run: |
pip --no-cache-dir install ${{ matrix.pip-install-target }}
playwright install
- name: Add pytest options to enable coverage report
if: matrix.cov-report
run: echo PYTEST_ADDOPTS="$PYTEST_ADDOPTS --cov --cov-report=xml" >> $GITHUB_ENV
- name: Run pytest
# Skip tests that require API Keys (Secrets) when pull request is opened
run: |
if [ ${{ github.event_name }} == 'pull_request' ]; then
pytest -v -m "not secrets and not scip and not widgets"
else
pytest -v -m "not scip and not widgets"
fi
- name: Upload coverage report as job artifact
if: matrix.cov-report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
if-no-files-found: error
upload-codecov:
name: Upload coverage to Codecov
needs: [pytest]
runs-on: ubuntu-latest
steps:
# the checkout step is needed to have access to codecov.yml
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: coverage-report
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
# NOTE: secrets are not available for pull_request workflows
# However, as of 2024-02-10, Codecov is still allowing tokenless upload from PRs
# but does require token for other workflows e.g. merge to `main`
# see https://github.com/codecov/codecov-action/issues/1274#issuecomment-1934437359
token: ${{ secrets.CODECOV_TOKEN }}
black:
name: Run Black to verify that committed code is formatted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install (dev mode)
run: |
pip --no-cache-dir install --progress-bar off -r requirements-dev.txt
- name: Run Black to verify that committed code is formatted
run: |
black --check .
isort:
name: Run isort to verify that committed code has imports alphabetically sorted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install (dev mode)
run: |
pip --no-cache-dir install --progress-bar off -r requirements-dev.txt
- name: Run isort
run: |
isort --check primo