chore: add CI check for openapi spec generation #4225
This file contains hidden or 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: Linters | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
jobs: | |
ruff-lint-check: | |
name: Ruff Lint Check | |
runs-on: ubuntu-24.04 | |
steps: | |
# Common steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: "2.0.1" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "poetry" | |
- name: Install dependencies | |
run: poetry install --all-extras | |
# Job-specific step(s): | |
- name: Run lint check | |
run: poetry run ruff check . | |
ruff-format-check: | |
name: Ruff Format Check | |
runs-on: ubuntu-24.04 | |
steps: | |
# Common steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: "1.8.4" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "poetry" | |
- name: Install dependencies | |
run: poetry install --all-extras | |
# Job-specific step(s): | |
- name: Check code format | |
run: poetry run ruff format --diff . | |
mypy-check: | |
name: MyPy Check | |
runs-on: ubuntu-24.04 | |
steps: | |
# Common steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: "1.8.4" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "poetry" | |
- name: Install dependencies | |
run: poetry install --all-extras | |
# Job-specific step(s): | |
- name: Run mypy | |
run: poetry run mypy --config-file mypy.ini airbyte_cdk | |
openapi-check: | |
name: OpenAPI Spec Check | |
runs-on: ubuntu-24.04 | |
steps: | |
# Common steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: "2.0.1" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "poetry" | |
- name: Install dependencies | |
run: poetry install --all-extras | |
# Job-specific step(s): | |
- name: Generate OpenAPI spec | |
run: poetry run manifest-server generate-openapi | |
- name: Check for changes | |
id: git-diff | |
run: | | |
git diff --quiet && echo "No changes to commit" || echo "changes=true" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Fail if OpenAPI spec is outdated | |
if: steps.git-diff.outputs.changes == 'true' | |
run: | | |
echo "❌ OpenAPI spec is out of date!" | |
echo "" | |
echo "The manifest-server API models have been modified, but the OpenAPI spec hasn't been updated." | |
echo "The following files have changes:" | |
git diff --name-only | |
echo "" | |
echo "Please run the following command and commit the changes:" | |
echo "" | |
echo " poetry run manifest-server generate-openapi" | |
echo "" | |
exit 1 |