[DOP-16658] Initialize repo #9
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: Tests | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches-ignore: | |
- master | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
env: | |
DEFAULT_PYTHON: '3.12' | |
jobs: | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Start DB Container | |
run: | | |
docker compose -f docker-compose.test.yml down -v --remove-orphans | |
docker compose -f docker-compose.test.yml up --wait-timeout 5 -d | |
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
- name: Cache poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-test-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-test-${{ hashFiles('**/poetry.lock') }} | |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-test- | |
${{ runner.os }}-python- | |
- name: Install dependencies | |
run: | | |
poetry install --no-root --all-extras --with test --without dev,docs | |
- name: Run Tests | |
run: | | |
source .env.local | |
mkdir -p reports/ | |
poetry run coverage run -m pytest | |
- name: Upload Coverage Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: raw-coverage-${{ env.DEFAULT_PYTHON }} | |
path: reports/.coverage* | |
- name: Shutdown Backend Container | |
if: always() | |
run: | | |
docker compose -f docker-compose.test.yml down -v --remove-orphans | |
all_done: | |
name: Tests done | |
runs-on: ubuntu-latest | |
needs: [tests] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-coverage | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip setuptools wheel | |
- name: Install dependencies | |
run: pip install -I coverage pytest | |
- name: Download all raw coverage data | |
uses: actions/download-artifact@v4 | |
with: | |
path: coverage-data/ | |
pattern: raw-coverage-* | |
- name: Combine Coverage Data | |
run: | | |
coverage combine coverage-data/* | |
coverage xml -o combined_coverage.xml | |
- name: Check Coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./combined_coverage.xml | |
fail_ci_if_error: true | |
plugin: noop | |
- name: All done | |
run: echo 1 |