DGC-306 keyword endpoints #2
Workflow file for this run
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: Backend CI | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# When this action will be executed | |
on: | |
# Automatically trigger it when detected changes in repo | |
push: | |
branches: | |
- main | |
paths: | |
- "api/**" | |
- ".github/workflows/backend_ci.yml" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "api/**" | |
- ".github/workflows/backend_ci.yml" | |
# Allow manual trigger | |
workflow_dispatch: | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
jobs: | |
pytest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
- name: Setup a local virtual environment (if no poetry.toml file) | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- name: Define a cache for the virtual environment based on the dependencies lock file | |
uses: actions/cache@v3 | |
with: | |
path: ./api/.venv | |
key: venv-${{ hashFiles('poetry.lock') }} | |
- name: Install the project dependencies | |
working-directory: api | |
run: poetry install --with=dev | |
- name: Run Pytest | |
working-directory: api | |
run: poetry run pytest tests/ --junit-xml=test-results.xml | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: | | |
api/test-results.xml |