From 891ccf45c0bc11082f7b197a5445962557d74df6 Mon Sep 17 00:00:00 2001 From: Jan-Frederik Schmidt Date: Sun, 9 Jun 2024 13:54:28 +0200 Subject: [PATCH] ci: Add GitHub actions pipeline --- .github/workflows/pipeline.yml | 83 ++++++++++++++++++++++++++++++++++ tox.ini | 3 ++ 2 files changed, 86 insertions(+) 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..73163ff --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,83 @@ +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"] + + 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.8 + + - name: Download all coverage artifacts + uses: actions/download-artifact@v3 + + - name: Copy coverage reports to reports folder + run: mkdir reports && find . -type f -path "./coverage-3.*/*" -exec cp {} 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 diff --git a/tox.ini b/tox.ini index fa52f29..dc8d187 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,9 @@ envlist = combine-test-reports isolated_build = True +[gh-actions] +python = + 3.8: py38-test [testenv:lint] description = Run static checkers.