vpoulailleau/python-dev-tools

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
on:
    push:
        branches:
            - main
            - master
    pull_request:
    schedule:
        - cron: 30 3 * 1 *

jobs:
    test:
        strategy:
            fail-fast: false
            matrix:
                os: [ubuntu-latest, macos-latest, windows-latest]
                python-version: ["3.8", "3.9", "3.10", "3.11"]
                poetry-version: [1.1.11]
        runs-on: ${{ matrix.os }}
        steps:
            - uses: actions/checkout@v3
            - name: Set up Python
              uses: actions/setup-python@v3
              with:
                  python-version: ${{ matrix.python-version }}
            - name: Set up Poetry
              uses: abatilo/actions-poetry@v2.0.0
              with:
                  poetry-version: ${{ matrix.poetry-version }}
            - name: Display Python version
              run: python --version
            - name: Install dependencies
              run: poetry install
            - name: Run pytest
              run: poetry run python -m pytest -s -vv --cov=python_dev_tools
            - name: Generate XML coverage report
              run: poetry run coverage xml
            - name: Upload coverage result for test
              uses: actions/upload-artifact@v3
              with:
                  name: coverage
                  path: coverage.xml

    coverage:
        needs: [test]
        name: coverage
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
            - name: Download coverage result
              uses: actions/download-artifact@v3
              with:
                  name: coverage
            - run: ls ${{github.workspace}}
            - run: cat ${{github.workspace}}/coverage.xml
            - uses: paambaati/codeclimate-action@v3.0.0
              env:
                  CC_TEST_REPORTER_ID: 2104b78eb55ebc9f29fb64b8b4e6a338a2ee07fa4fa2b375b09dd37a6776fe7a
              with:
                  coverageLocations: ${{github.workspace}}/coverage.xml:coverage.py