feat: fastapi schema-registry
module with DI and E2E tests
#3
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 in Docker | ||
on: | ||
pull_request: | ||
types: [ opened, synchronize, reopened ] | ||
push: | ||
branches: [ main ] | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
env: | ||
FORCE_COLOR: 1 | ||
PIP_PROGRESS_BAR: off | ||
PYTHONUNBUFFERED: 1 | ||
KARAPACE_DOTENV: ${{ github.workspace }}/karapace.config.env | ||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ '3.10', '3.11', '3.12' ] | ||
env: | ||
PYTEST_ADDOPTS: >- | ||
--log-dir=/tmp/ci-logs | ||
--log-file=/tmp/ci-logs/pytest.log | ||
--showlocals | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
cache: pip | ||
python-version: ${{ matrix.python-version }} | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21.0' | ||
- name: Install requirements | ||
run: make install | ||
- name: Resolve Karapace version | ||
run: | | ||
source ./venv/bin/activate | ||
KARAPACE_VERSION=$(python -c "from karapace import version; print(version.__version__)") | ||
echo KARAPACE_VERSION=$KARAPACE_VERSION >> $GITHUB_ENV | ||
- name: Run containers | ||
run: KARAPACE_VERSION=${{ env.KARAPACE_VERSION }} docker compose --file=container/compose.yml up --build --wait --detach | ||
- run: make install-dev | ||
- run: make unit-tests-in-docker | ||
env: | ||
COVERAGE_FILE: ".coverage.${{ matrix.python-version }}" | ||
PYTEST_ARGS: "--cov=src --cov-append --numprocesses 4" | ||
- run: make e2e-tests-in-docker | ||
env: | ||
COVERAGE_FILE: ".coverage.${{ matrix.python-version }}" | ||
PYTEST_ARGS: "--cov=src --cov-append --numprocesses 4" | ||
coverage: | ||
name: Coverage report | ||
runs-on: ubuntu-latest | ||
needs: tests | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: make install-dev | ||
- name: Download coverage | ||
id: download_coverage | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: coverage-* | ||
merge-multiple: true | ||
- name: Post coverage comment | ||
id: post_coverage_comment | ||
uses: py-cov-action/python-coverage-comment-action@v3 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
MERGE_COVERAGE_FILES: true | ||
- name: Store PR comment to be posted | ||
uses: actions/upload-artifact@v4 | ||
if: steps.post_coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' | ||
with: | ||
name: python-coverage-comment-action | ||
path: python-coverage-comment-action.txt |