Add several github workflows
This commit is contained in:
parent
8b78208f58
commit
bd9af98819
6 changed files with 297 additions and 0 deletions
93
.github/workflows/unit-tests.yml
vendored
Normal file
93
.github/workflows/unit-tests.yml
vendored
Normal file
|
@ -0,0 +1,93 @@
|
|||
---
|
||||
name: Unit-Tests
|
||||
|
||||
on: workflow_call
|
||||
|
||||
jobs:
|
||||
unit-tests:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false # Allows for matrix sub-jobs to fail without cancelling the rest
|
||||
matrix:
|
||||
platform: [ubuntu-latest, windows-latest]
|
||||
python-version: ["3.8", "3.12"]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup poetry
|
||||
id: poetry_setup
|
||||
uses: ItsDrike/setup-poetry@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
install-args: "--without lint --without release"
|
||||
|
||||
- name: Run pytest
|
||||
shell: bash
|
||||
run: |
|
||||
poetry run task test
|
||||
|
||||
python .github/scripts/normalize_coverage.py
|
||||
mv .coverage .coverage.${{ matrix.platform }}.${{ matrix.python-version }}
|
||||
|
||||
- name: Upload coverage artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage.${{ matrix.platform }}.${{ matrix.python-version }}
|
||||
path: .coverage.${{ matrix.platform }}.${{ matrix.python-version }}
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
|
||||
upload-coverage:
|
||||
needs: [unit-tests]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup poetry
|
||||
id: poetry_setup
|
||||
uses: ItsDrike/setup-poetry@v1
|
||||
with:
|
||||
python-version: 3.12
|
||||
install-args: "--no-root --only test"
|
||||
|
||||
- name: Download all coverage artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: coverage.*
|
||||
merge-multiple: true # support downloading multiple artifacts to same dir
|
||||
|
||||
# Combine all of the coverage files (for each os, python version - from matrix)
|
||||
# into a single coverage file (.coverage), and produce a final (combined) coverage report.
|
||||
- name: Combine coverage
|
||||
run: |
|
||||
coverage combine
|
||||
coverage xml
|
||||
coverage report
|
||||
|
||||
- name: Upload coverage to codeclimate
|
||||
uses: paambaati/codeclimate-action@v8.0.0
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: 0ec6191ea237656410b90dded9352a5b16d68f8d86d60ea8944abd41d532e869
|
||||
with:
|
||||
coverageLocations: .coverage.xml:coverage.py
|
||||
|
||||
tests-done:
|
||||
needs: [unit-tests]
|
||||
if: always() && !cancelled()
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Set status based on required jobs
|
||||
env:
|
||||
RESULTS: ${{ join(needs.*.result, ' ') }}
|
||||
run: |
|
||||
for result in $RESULTS; do
|
||||
if [ "$result" != "success" ]; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue