[DOP-13278] Implement Hive tests in github #20
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: Unit 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.11' | |
jobs: | |
tests: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
env: | |
POETRY_VERSION: 1.6.1 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
- name: Install poetry ${{ env.POETRY_VERSION }} | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
- name: Cache poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-${{ hashFiles('**/poetry.lock') }} | |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit- | |
${{ runner.os }}-python | |
${{ runner.os }} | |
- name: Install dependencies | |
run: | | |
poetry install --no-root --with backend,test | |
- name: Start docker compose | |
run: | | |
docker compose -f docker-compose.test.yml down -v --remove-orphans | |
docker compose -f docker-compose.test.yml up -d db --wait --wait-timeout 200 | |
env: | |
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster | |
- name: Run DB Tests. | |
run: | | |
source .env.local | |
mkdir -p reports/ | |
poetry run coverage run -m pytest -vvv -s ./syncmaster/tests/test_database | |
env: | |
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster | |
- name: Run Unit Tests. | |
run: | | |
source .env.local | |
poetry run coverage run -m pytest -vvv -s ./syncmaster/tests/test_unit | |
env: | |
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster | |
- name: Shutdown | |
if: always() | |
run: | | |
docker compose -f docker-compose.test.yml down -v --remove-orphans | |
env: | |
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster |