From 185c339737255a362ec353b8fb8aaf08f48b0a9e Mon Sep 17 00:00:00 2001 From: Niels Date: Thu, 17 Oct 2024 21:10:15 +0200 Subject: [PATCH] Update workflow --- .github/workflows/python-app.yml | 58 +++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 3b6281c..8475c35 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python application +name: Tests and QA on: push: @@ -13,29 +13,57 @@ permissions: contents: read jobs: - build: - - runs-on: ubuntu-latest + test: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [ '3.8', '3.9', '3.10', '3.11' ] steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} + - name: Install Poetry uses: snok/install-poetry@v1 + - name: Install dependencies + run: poetry install --no-interaction --with dev + + - name: Run linters run: | - poetry install + poetry run black --check . + - name: Build contracts run: | bash tests/build_contracts.sh + - name: Test with pytest run: | - poetry run pytest --cov-report xml:coverage.xml - - name: Upload coverage.xml - uses: orgoro/coverage@v3.2 - with: - coverageFile: coverage.xml - token: ${{ secrets.GITHUB_TOKEN }} + poetry run coverage run -m pytest + # add further tests with `poetry run coverage run -a ...` + + - name: Upload coverage data to coveralls.io + run: poetry run coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: ${{ matrix.python-version }} + COVERALLS_PARALLEL: true + + + coveralls: + name: Indicate completion to coveralls.io + needs: test + runs-on: ubuntu-latest + container: python:3-slim + steps: + - name: Install coveralls + run: pip3 install --upgrade coveralls + - name: Finished + run: coveralls --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file