release: v0.9.6 #1259
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: Build, Test and Publish | |
| on: | |
| merge_group: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| urllib3-version: ["1.26.19", "2.2.2"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| cache-dependency-path: | | |
| **/pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| pip install uv | |
| export UV_LINK_MODE=copy && \ | |
| uv sync --group dev && \ | |
| uv run ruff check --select I --fix . && \ | |
| uv run ruff format . && \ | |
| uv build | |
| - name: Run tests and collect coverage | |
| run: | | |
| export UV_LINK_MODE=copy && \ | |
| uv sync --group dev && \ | |
| uv run --with "urllib3==${{ matrix.urllib3-version }}" \ | |
| pytest --cov-report term-missing --cov=openfga_sdk --cov-fail-under=60 test/ && \ | |
| uv run ruff check . | |
| - if: matrix.python-version == '3.10' && matrix.urllib3-version == '1.26.19' | |
| name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 | |
| continue-on-error: true | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: openfga/python-sdk | |
| publish: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [test] | |
| permissions: | |
| id-token: write # Required for PyPI trusted publishing | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" | |
| cache-dependency-path: | | |
| **/pyproject.toml | |
| **/requirements*.txt | |
| **/test-requirements*.txt | |
| - name: Install dependencies | |
| run: pip install -r test-requirements.txt --upgrade pip | |
| - name: Build package | |
| run: | | |
| pip install setuptools wheel | |
| python setup.py sdist bdist_wheel | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 | |
| create-release: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [publish] | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803 # v3.0.1 | |
| with: | |
| version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |