Uv migration #1421
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: Generate OpenAPI Schema | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - '**' | |
| - '!.editorconfig' | |
| - '!webview/**' | |
| - '!website/**' | |
| - '!.github/workflows/deploy-website.yaml' | |
| - '!.github/workflows/build-webview.yaml' | |
| - '!.github/workflows/build-balena-disk-image.yaml' | |
| - '!.github/workflows/python-lint.yaml' | |
| - '!.github/release.yml' | |
| - '!.github/dependabot.yml' | |
| - '!README.md' | |
| - '!CONTRIBUTING.md' | |
| - '!docs/**' | |
| - '!bin/install.sh' | |
| - '!bin/upgrade_containers.sh' | |
| - '!tests/**' | |
| - '!.cursor/**' | |
| pull_request: | |
| branches: | |
| - master | |
| paths: | |
| - '**' | |
| - '!.editorconfig' | |
| - '!webview/**' | |
| - '!website/**' | |
| - '!.github/workflows/deploy-website.yaml' | |
| - '!.github/workflows/build-webview.yaml' | |
| - '!.github/workflows/build-balena-disk-image.yaml' | |
| - '!.github/workflows/python-lint.yaml' | |
| - '!.github/release.yml' | |
| - '!.github/dependabot.yml' | |
| - '!README.md' | |
| - '!CONTRIBUTING.md' | |
| - '!docs/**' | |
| - '!bin/install.sh' | |
| - '!bin/upgrade_containers.sh' | |
| - '!tests/**' | |
| - '!.cursor/**' | |
| workflow_call: | |
| jobs: | |
| generate-openapi-schema: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| COMPOSE_FILE: docker-compose.dev.yml | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: '0.9.17' | |
| - name: Install dependencies | |
| run: | | |
| uv venv | |
| uv pip install --group docker-image-builder | |
| - name: Cache Docker layers | |
| uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-x86 | |
| restore-keys: | | |
| ${{ runner.os }}-x86 | |
| - name: Build Images | |
| run: | | |
| uv run python -m tools.image_builder \ | |
| --dockerfiles-only \ | |
| --disable-cache-mounts \ | |
| --environment=development | |
| docker compose build | |
| - name: Start the Containers | |
| run: | | |
| docker compose up -d | |
| - name: Wait for server to be ready | |
| run: | | |
| for i in $(seq 1 30); do | |
| if docker compose exec anthias-server python -c "import django" 2>/dev/null; then | |
| echo "Server is ready" | |
| break | |
| fi | |
| echo "Waiting for server... ($i/30)" | |
| sleep 2 | |
| done | |
| - name: Generate OpenAPI Schema | |
| run: | | |
| docker compose exec anthias-server \ | |
| ./manage.py spectacular \ | |
| --format openapi-json \ | |
| --file anthias-api-schema.json | |
| - name: Upload the OpenAPI Schema | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: anthias-api-schema | |
| path: anthias-api-schema.json |