Merge pull request #1703 from Anselmoo/renovate/pytest-cov-6.x-lockfile #4740
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: CI - Python Package | |
on: | |
push: | |
branches: [main, feature/*, release/*, hotfix/*] | |
pull_request: | |
branches: [main, develop] | |
repository_dispatch: | |
types: [create-pull-request] | |
jobs: | |
pre-commit: | |
name: Pre-commit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Install pre-commit | |
run: | | |
python -m pip install --upgrade pip | |
pip install pre-commit | |
pip freeze --local | |
- name: Cash pre-commit | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pre-commit- | |
- name: Pre-commit | |
run: | | |
pre-commit run --all-files --color=always | |
build: | |
name: Python ${{ matrix.python-version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | |
needs: pre-commit | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
arch: [x64] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry and dependencies with dev-dependencies | |
run: | | |
python -m pip install --upgrade pip | |
# if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
# pip install poetry | |
# else | |
pip install poetry | |
# fi | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project true | |
poetry config virtualenvs.path .venv | |
poetry install --no-interaction --with dev -E all | |
- name: Test SpectraFit | |
run: poetry run pytest | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
name: codecov-umbrella | |
flags: unittests | |
verbose: true | |
env_vars: OS,PYTHON | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
minimal-build: | |
name: Build SpectraFit without dev-dependencies | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry and dependencies without dev-dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project true | |
poetry config virtualenvs.path .venv | |
poetry install --no-interaction --only main | |
documentation: | |
name: Build Documentation | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry and dependencies with doc-dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project true | |
poetry config virtualenvs.path .venv | |
poetry install --no-interaction --with docs --all-extras | |
- name: Set git config | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Build documentation | |
if: ${{ !contains(github.ref, 'refs/heads/main')}} | |
run: poetry run mkdocs build --clean | |
- name: Deploy documentation develops | |
if: contains(github.ref, 'refs/heads/main') | |
run: poetry run mike deploy --push --update-aliases develop | |
devcontainer: | |
name: Devcontainer | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build devcontainer | |
uses: devcontainers/[email protected] |