Skip to content

Unit Tests

Unit Tests #240

Workflow file for this run

---
name: Unit Tests
on: # NOLINT
pull_request:
push:
schedule:
- cron: '0 10 * * MON'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-20.04, ubuntu-22.04, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v3
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v3
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade wheel
python -m pip install --upgrade coverage
python -m pip install --upgrade mypy
python -m pip install --upgrade statick
python -m pip install --upgrade statick-md
python -m pip install --upgrade tox
python -m pip install --upgrade tox-gh-actions
python -m pip install --upgrade virtualenv
python -m pip install -r requirements.txt
# Have to install newer version from non-apt source due to SSL library compatibility issues.
- name: Install tools (Linux)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04'
run: |
npm install -g eslint
# eslint plugins and configs should be installed locally
# https://eslint.org/docs/user-guide/migrating-to-6.0.0#plugins-and-shareable-configs-are-no-longer-affected-by-eslints-location
npm install --prefix $HOME/.node_modules eslint-plugin-html
npm install --prefix $HOME/.node_modules eslint-plugin-prettier
npm install --prefix $HOME/.node_modules eslint-config-prettier
npm install -g htmllint-cli
npm install -g jshint
npm install -g markdownlint-cli
npm install -g prettier
npm install -g postcss-html # needed for stylelint to process html
npm install -g stylelint
npm install -g stylelint-config-standard
# View versions of installed packages
npm list --prefix $HOME/.node_modules
npm list -g
- name: Mypy
run: |
mypy --ignore-missing-imports --strict src/
- name: Tox
run: |
python -m tox
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
- name: Statick Documentation
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04'
run: |
statick . --check --profile documentation.yaml
- name: Self check
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04'
run: |
mkdir statick-output
statick . --output-directory statick-output --check --profile self_check.yaml