Move openapi.yaml and fix schema #55
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: Test, build and release | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '**' | |
paths-ignore: | |
- 'releases/**' | |
pull_request: | |
branches: | |
- '**' | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
run: pip install poetry | |
- name: Set up cache | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }} | |
- name: Install dependencies | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry install --no-root --with dev,test | |
- name: Run style checks | |
run: | | |
poetry run mypy . | |
poetry run isort . --check --diff | |
poetry run flake8 . | |
poetry run black . --check --diff | |
- name: Verify OpenAPI spec has been updated | |
run: | | |
poetry run python ./tools/extract_openapi.py app.main:app --app-dir . --out openapi_generated.yaml | |
git diff --exit-code ./openapi/openapi.yaml openapi_generated.yaml | |
- name: Run tests | |
run: poetry run pytest | |
build: | |
runs-on: ubuntu-latest | |
needs: [test] | |
steps: | |
- name: Checkout | |
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: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Make versions | |
run: | | |
chmod +x ./tools/version.sh | |
./tools/version.sh "${{ github.sha }}" "${{ secrets.DOCKER_IMAGE_NAME }}" | |
DOCKER_IMAGES=$(cat "./DOCKER_IMAGES") | |
echo "DOCKER_IMAGES=$DOCKER_IMAGES" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ env.DOCKER_IMAGES }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [build] | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
- name: Make versions | |
run: | | |
chmod +x ./tools/version.sh | |
./tools/version.sh "${{ github.sha }}" "${{ secrets.DOCKER_IMAGE_NAME }}" | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |