From 15ee8bf0c0e869e15c15dc6db0359c9b7c6b5ead Mon Sep 17 00:00:00 2001 From: Felipe Peter Date: Thu, 14 Dec 2023 10:25:00 +0800 Subject: [PATCH] ci: Add CI pipeline via GitHub actions --- .github/workflows/pipeline.yml | 80 ++++++++++++++++++++++++++++++++++ setup.cfg | 2 +- tox.ini | 16 +++++-- 3 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/pipeline.yml diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 0000000..70be3ad --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,80 @@ +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/upload-artifact@v3.1.2 + 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 + + - 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 diff --git a/setup.cfg b/setup.cfg index 0f062f5..c108775 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/tox.ini b/tox.ini index 6f85ae2..303ce0b 100644 --- a/tox.ini +++ b/tox.ini @@ -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 = @@ -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 @@ -45,7 +52,7 @@ 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] @@ -54,6 +61,7 @@ commands = coverage combine --keep coverage html coverage xml + coverage report [testenv:docs]