coverage #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Full CI | |
on: | |
push: | |
branches: [main, dev] | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
job: | |
description: 'Choose which job to run' | |
required: true | |
default: 'deploy' | |
type: choice | |
options: | |
- publish-module | |
- test-Django | |
- coverage | |
- all | |
permissions: | |
contents: read | |
jobs: | |
publish-module: | |
if: github.event_name == 'release' || github.event.inputs.job == 'publish-module' || github.event.inputs.job == 'all' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Check current folder | |
run: | | |
ls | |
- name: Build package | |
run: | | |
python -m build | |
- name: Publish build | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
test-Django: | |
if: github.event.inputs.job == 'test-Django' || github.event.inputs.job == 'all' || github.event_name == 'release' || github.event_name == 'push' | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
cd ./test/app/ | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install ../../ | |
- name: Run Tests | |
run: | | |
cd ./test/app/ | |
python manage.py test | |
coverage: | |
if: github.event.inputs.job == 'coverage' || github.event.inputs.job == 'all' || github.event_name == 'release' || github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: Install Dependencies | |
run: | | |
cd ./test/app/ | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install coverage | |
pip install ../../ | |
- name: Run Coverage | |
run: | | |
cd ./test/app/ | |
coverage run manage.py test | |
coverage xml | |
- name: Upload Coverage to GitHub | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-report | |
path: ./test/coverage.xml | |
- name: Report Coverage | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./test/app/coverage.xml |