Skip to content

Commit

Permalink
ci: Add CI pipeline via GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Pepe committed Dec 14, 2023
1 parent 79cf2af commit 1f838d8
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 7 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI pipeline

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install tox
run: python -m pip install --upgrade pip tox tox-gh-actions

- name: Run tests
run: tox

- name: Upload coverage artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/[email protected]
with:
name: coverage-${{ matrix.python-version }}
path: reports/.coverage.*test

coverage:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Download all coverage artifacts
uses: actions/download-artifact@v3
with:
path: reports

- name: Install tox
run: python -m pip install --upgrade pip tox

- name: Combine coverage results
run: tox run -e combine-test-reports

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install tox
run: python -m pip install --upgrade tox

- name: Run static checks
run: tox -e lint
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ url = https://github.com/vorausrobotik/voraus-template-updater


[options]
python_requires = >=3.9
python_requires = >=3.8
packages = find:
package_dir =
=src
Expand Down
18 changes: 12 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
[tox]
envlist =
lint
{py39,py311}-test
{py38,py39,py310,py311,py312}-test
combine-test-reports
isolated_build = True

[gh-actions]
python =
3.8: py38-test
3.9: py39-test
3.10: py310-test
3.11: py311-test
3.12: py312-test

[testenv:lint]
description = Run static checkers.
basepython = py39
basepython = py38
extras = lint
passenv = CODEMETER_HOST
commands =
Expand All @@ -26,7 +33,7 @@ commands =
pylint --load-plugins pylint.extensions.docparams src {posargs}


[testenv:{py39,py311}-test]
[testenv:{py38,py39,py310,py311,py312}-test]
description = Run doc tests and unit tests.
package = wheel
extras = test
Expand All @@ -45,15 +52,14 @@ description = Combine test and coverage data from multiple test runs.
skip_install = true
setenv =
COVERAGE_FILE = reports/.coverage
depends = {py39,py311}-test
depends = {py38,py39,py310,py311,py312}-test
deps =
junitparser
coverage[toml]
commands =
junitparser merge --glob reports/pytest.xml.* reports/pytest.xml
coverage combine --keep
coverage html
coverage xml
coverage report


[testenv:docs]
Expand Down

0 comments on commit 1f838d8

Please sign in to comment.