Merge pull request #10 from mihamieat/develop #34
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: GPacAPI FastAPI CI | |
'on': | |
push: | |
branches: | |
- master | |
- develop | |
- feature/* | |
- fix/* | |
- hotfix/* | |
- refactor/* | |
- test/* | |
- ci/* | |
jobs: | |
code-quality: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.6 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pipx | |
pipx install poetry | |
poetry install | |
- name: Run pylint | |
run: poetry run pylint src/ | |
- name: Run black check | |
run: poetry run black . --check --diff -v | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.6 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pipx | |
pipx install poetry | |
poetry install | |
- name: run build | |
run: poetry build | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
mongodb-version: ['5.0', '6.0', '7.0'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.6 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pipx | |
pipx install poetry | |
poetry install | |
- name: Install and run MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: ${{ matrix.mongodb-version }} | |
- name: Run Tests | |
run: poetry run pytest --cov=src tests/ --junitxml=junit.xml -o junit_family=legacy | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: junit.xml | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |