chore: add books_cli example project to demo pytest-sqlguard #55
Workflow file for this run
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: SQLGuard CI/CD | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "*" | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test-sqlguard: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/astral-sh/uv:debian-slim | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run tests with uv | |
| run: | | |
| export UV_LINK_MODE=copy | |
| uv sync --all-extras | |
| uv run pytest tests | |
| test-tox-sqlguard: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/astral-sh/uv:debian-slim | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Tox & Tox UV | |
| run: | | |
| uv tool install tox --with tox-uv | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Run Tox suite | |
| run: tox run -- tests | |
| build-sqlguard: | |
| needs: [test-sqlguard, test-tox-sqlguard] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/astral-sh/uv:debian-slim | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build package | |
| run: uv build | |
| - name: "Upload Artifact" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sqlguard-dist | |
| path: dist | |
| retention-days: 5 | |
| publish-sqlguard: | |
| needs: [build-sqlguard] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for Trusted Publishing | |
| id-token: write | |
| # Needed for fetching the code | |
| contents: read | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sqlguard-dist | |
| path: dist | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |