Skip to content

merge: Configure coverage.py #50

merge: Configure coverage.py

merge: Configure coverage.py #50

Workflow file for this run

# SPDX-FileCopyrightText: Copyright DB Netz AG and the capellambse contributors
# SPDX-License-Identifier: CC0-1.0
name: Code QA
on:
workflow_dispatch:
push:
branches: [master]
tags: ["v*.*.*"]
pull_request:
jobs:
test:
name: Test with Python ${{matrix.python_version}} on ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python_version:
- "3.9"
- "3.10"
- "3.11"
include:
- os: windows-latest
python_version: "3.9"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{matrix.python_version}}
uses: actions/setup-python@v4
with:
cache: pip
cache-dependency-path: pyproject.toml
python-version: ${{matrix.python_version}}
- name: Upgrade Pip
run: python -m pip install -U pip
- name: Install test dependencies
run: python -m pip install '.[test]'
- name: Run unit tests
run: python -m pytest --cov-report=term --cov=capellambse --rootdir=.
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
cache: pip
cache-dependency-path: pyproject.toml
python-version: "3.11"
- name: Upgrade pip
run: python -m pip install -U pip
- name: Install pre-commit
run: python -m pip install pre-commit
- name: Run Pre-Commit
run: pre-commit run --all-files
publish:
name: Publish artifacts
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
cache: pip
cache-dependency-path: pyproject.toml
python-version: "3.11"
- name: Install dependencies
run: python -m pip install -U pip build twine
- name: Build packages
run: python -m build
- name: Verify packages
run: python -m twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: 'dist/*'
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
run: python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --non-interactive dist/*