Skip to content

[pre-commit.ci] pre-commit autoupdate (#303) #750

[pre-commit.ci] pre-commit autoupdate (#303)

[pre-commit.ci] pre-commit autoupdate (#303) #750

name: CI - Tests
on:
pull_request:
push:
branches:
- 'main'
- 'push-action/**'
jobs:
base-tests:
name: Call reusable workflow
uses: ./.github/workflows/ci_tests.yml
with:
# general
install_extras: "[dev,docs,testing]"
# pylint & safety
run_pylint: false
run_safety: true
# ID: 70612
# Package: Jinja2
# Has been disputed by the maintainer and multiple third parties.
# For more information see: https://github.com/advisories/GHSA-f6pv-j8mr-w6rr
safety_options: |
--ignore=70612
# build dist
build_libs: flit
build_cmd: flit build
# build docs
update_python_api_ref: true
update_docs_landing_page: false
package_dirs: ci_cd
debug: false
pytest:
name: pytest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: ["ubuntu-latest", "windows-latest"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel flit
pip install -e .[testing]
- name: Test with pytest
run: pytest -vvv --cov=ci_cd --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.9' && github.repository == 'SINTEF/ci-cd'
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# These jobs are mainly to test a default run of the hooks including `--pre-commit`
run_hooks:
name: Run custom pre-commit hooks
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Use lowest and highest supported (stable) Python version
python-version: ["3.7", "3.12"]
os: ["ubuntu-latest", "windows-latest"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel flit
pip install -e .
pip install -U pre-commit
# docs-api-reference
- name: Run docs-api-reference ('ci-cd create-api-reference-docs')
run: python .github/utils/run_hooks.py docs-api-reference
- name: Run docs-api-reference ('ci-cd create-api-reference-docs') (cmd)
if: runner.os == 'Windows'
run: python .github/utils/run_hooks.py docs-api-reference
shell: cmd
# docs-landing-page
- name: Run docs-landing-page ('ci-cd create-docs-index')
run: python .github/utils/run_hooks.py docs-landing-page
- name: Run docs-landing-page ('ci-cd create-docs-index') (cmd)
if: runner.os == 'Windows'
run: python .github/utils/run_hooks.py docs-landing-page
shell: cmd
# update-pyproject
- name: Run update-pyproject ('ci-cd update-deps')
run: python .github/utils/run_hooks.py update-pyproject
- name: Run update-pyproject ('ci-cd update-deps') (cmd)
if: runner.os == 'Windows'
run: python .github/utils/run_hooks.py update-pyproject
shell: cmd
# set-version
- name: Run 'ci-cd setver'
run: python .github/utils/run_hooks.py set-version
- name: Run 'ci-cd setver' (cmd)
if: runner.os == 'Windows'
run: python .github/utils/run_hooks.py set-version
shell: cmd