From b6bfc2409cca8c0fc777e532a509fbf83451a42e Mon Sep 17 00:00:00 2001 From: Semantic Versioner Date: Sat, 22 Jul 2023 04:46:03 -0400 Subject: [PATCH] Add unit test workflow --- .github/workflows/unittests.yaml | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/unittests.yaml diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml new file mode 100644 index 0000000..a834970 --- /dev/null +++ b/.github/workflows/unittests.yaml @@ -0,0 +1,44 @@ +name: Unit Tests + +on: + push: + branches: + - master + - feature/refactor + pull_request: {} + +jobs: + test: + name: Unit Tests + runs-on: ubuntu-22.04 + + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, 3.10, 3.11] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + cache: pip + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + pip install -r requirements.txt + + - name: pytest + run: | + pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=semver | tee pytest-coverage.txt + + - name: Comment Result Summary + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml + if: github.event_name == 'pull_request'