feature: Upgrade to build schema with 3.4.1 (#75) #214
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
merge_group: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
COLUMNS: "120" | |
FORCE_COLOR: "1" | |
PYTHONUNBUFFERED: "1" | |
jobs: | |
lint: | |
name: Static analysis | |
uses: less-action/reusables/.github/workflows/pre-commit.yaml@0afb53ddb81137deb9d41e7d911eb1755bb451e3 | |
with: | |
python-version: "3.11" | |
check-build: | |
name: Check packaging metadata | |
uses: less-action/reusables/.github/workflows/python-test-build.yaml@0afb53ddb81137deb9d41e7d911eb1755bb451e3 | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11", "3.12-dev"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Start Kafka backend | |
run: docker compose --file=container/compose.yml up -d | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: setup.cfg | |
- name: Install requirements | |
run: pip install --upgrade -e '.[test]' | |
- name: Run test suite | |
run: python -X dev -m coverage run -m pytest | |
# TODO: Enable coverage reporting. | |
# - name: Collect coverage | |
# run: | | |
# coverage report | |
# coverage xml | |
# - name: Report coverage | |
# uses: codecov/codecov-action@v3 | |
# with: | |
# file: coverage.xml | |
# fail_ci_if_error: true | |
# name: codecov-py${{ matrix.python-version }} | |
check-generate-schema: | |
name: Check schema | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: pip | |
cache-dependency-path: setup.cfg | |
check-latest: true | |
- name: pre-commit cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: >- | |
${{ runner.os }} | |
-pre-commit | |
-3.11 | |
-${{ hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pre-commit-3.11 | |
${{ runner.os }}-pre-commit | |
- name: Schema cache | |
uses: actions/cache@v3 | |
with: | |
path: schema | |
key: schema-${{ hashFiles('codegen/fetch_schema.py') }} | |
restore-keys: schema | |
- run: pip install --upgrade .[all] | |
- run: make fetch-schema-src | |
- run: | | |
make generate-schema | |
diff=$(git --no-pager diff) | |
if [[ ! -z "$diff" ]]; then | |
echo "💥 Non-empty output from git diff." | |
echo | |
echo "$diff" | |
exit 1 | |
else | |
echo "✅ No diff to current schema." | |
fi | |
docs: | |
name: Build Sphinx Docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: pip | |
cache-dependency-path: docs/requirements.txt | |
- name: Install dependencies | |
run: pip install --require-hashes -r docs/requirements.txt | |
- name: Build docs | |
# Should use -W here to promote warnings to errors, but can't for now because of | |
# a false positive for usage of _typeshed.DataclassInstance. | |
run: sphinx-build -b html docs docs/_build |