PDFCLOUD-5351 Initial Python API for pdfRest #7
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: Test and Publish | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| - feature-* | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| tests: | |
| name: Tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| packages: write | |
| pull-requests: write | |
| env: | |
| UV_PROJECT_ENVIRONMENT: .venv-${{ matrix.python-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: 0.8.22 | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| cache-suffix: pre-commit | |
| cache-dependency-glob: uv.lock | |
| - name: Restore venv cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ env.UV_PROJECT_ENVIRONMENT }} | |
| key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }} | |
| - name: Synchronize project dependencies | |
| run: uv sync --group dev | |
| - name: Run tests | |
| run: uv run pytest | |
| publish: | |
| name: Publish to CodeArtifact | |
| needs: tests | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| packages: write | |
| env: | |
| UV_PROJECT_ENVIRONMENT: .venv-release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Assume AWS role for repository CI | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::304774597385:role/cit-oidc-role-${{ github.event.repository.name }}-ci | |
| aws-region: us-east-2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v1 | |
| - name: Restore uv cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/uv | |
| ${{ env.UV_PROJECT_ENVIRONMENT }} | |
| key: ${{ runner.os }}-uv-release-${{ hashFiles('pyproject.toml') }} | |
| - name: Synchronize project dependencies | |
| run: uv sync --group dev | |
| - name: Build distribution artifacts | |
| run: uv build | |
| - name: Log in to CodeArtifact for publishing | |
| run: >- | |
| aws codeartifact login | |
| --tool twine | |
| --domain datalogics | |
| --domain-owner 304774597385 | |
| --repository cit-pypi | |
| --region us-east-2 | |
| - name: Publish package to CodeArtifact | |
| run: uv tool run --from twine twine upload --non-interactive --skip-existing dist/* |