chore: update api pyproject #56
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 | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
# Generic | |
FORCE_COLOR: '1' | |
CLICOLOR: '1' | |
# Python | |
HATCH_VERBOSE: '1' | |
PYTEST_ADDOPTS: --color=yes | |
PYTHONUNBUFFERED: '1' | |
STABLE_PYTHON_VERSION: '3.13' | |
jobs: | |
complete: | |
name: Completion check | |
if: always() | |
permissions: | |
contents: none | |
runs-on: ubuntu-latest | |
needs: | |
- format | |
- lint | |
- typecheck | |
- test | |
- spelling | |
- pre-commit | |
steps: | |
- name: Failed | |
run: exit 1 | |
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, | |
'skipped') | |
format: | |
name: >- | |
Format Python | |
(${{ matrix.d == '.' && 'Core' || matrix.d == 'pypacter-api' && 'API' || 'Unknown' }}) | |
on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {os: ubuntu-latest, d: .} | |
- {os: ubuntu-latest, d: pypacter-api} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
submodules: true | |
- name: Set up uv | |
uses: astral-sh/setup-uv@2e657c127d5b1635d5a8e3fa40e0ac50a5bf6992 # v3.2.2 | |
with: | |
enable-cache: true | |
cache-dependency-glob: | | |
**/pyproject.toml | |
**/uv.lock | |
- name: Install Python | |
run: uv python install ${{ env.STABLE_PYTHON_VERSION }} | |
- name: Install Hatch | |
run: uv tool install hatch | |
- name: Format | |
run: hatch run format | |
working-directory: ${{ matrix.d }} | |
lint: | |
name: >- | |
Lint Python | |
(${{ matrix.d == '.' && 'Core' || matrix.d == 'pypacter-api' && 'API' || 'Unknown' }}) | |
on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {os: ubuntu-latest, d: .} | |
- {os: ubuntu-latest, d: pypacter-api} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
submodules: true | |
- name: Set up uv | |
uses: astral-sh/setup-uv@2e657c127d5b1635d5a8e3fa40e0ac50a5bf6992 # v3.2.2 | |
with: | |
enable-cache: true | |
cache-dependency-glob: | | |
**/pyproject.toml | |
**/uv.lock | |
- name: Install Python | |
run: uv python install ${{ env.STABLE_PYTHON_VERSION }} | |
- name: Install Hatch | |
run: uv tool install hatch | |
- name: Lint | |
run: hatch run lint | |
working-directory: ${{ matrix.d }} | |
typecheck: | |
name: >- | |
Typecheck Python | |
(${{ matrix.d == '.' && 'Core' || matrix.d == 'pypacter-api' && 'API' || 'Unknown' }}) | |
on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {os: ubuntu-latest, d: .} | |
- {os: ubuntu-latest, d: pypacter-api} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
submodules: true | |
- name: Set up uv | |
uses: astral-sh/setup-uv@2e657c127d5b1635d5a8e3fa40e0ac50a5bf6992 # v3.2.2 | |
with: | |
enable-cache: true | |
cache-dependency-glob: | | |
**/pyproject.toml | |
**/uv.lock | |
- name: Install Python | |
run: uv python install ${{ env.STABLE_PYTHON_VERSION }} | |
- name: Install Hatch | |
run: uv tool install hatch | |
- name: Typecheck | |
run: hatch run typecheck | |
working-directory: ${{ matrix.d }} | |
test: | |
name: >- | |
Test Python | |
(${{ matrix.d == '.' && 'Core' || matrix.d == 'pypacter-api' && 'API' || 'Unknown' }}) | |
on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {os: ubuntu-latest, d: .} | |
- {os: ubuntu-latest, d: pypacter-api} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
submodules: true | |
- name: Set up uv | |
uses: astral-sh/setup-uv@2e657c127d5b1635d5a8e3fa40e0ac50a5bf6992 # v3.2.2 | |
with: | |
enable-cache: true | |
cache-dependency-glob: | | |
**/pyproject.toml | |
**/uv.lock | |
- name: Install Python | |
run: uv python install ${{ env.STABLE_PYTHON_VERSION }} | |
- name: Install Hatch | |
run: uv tool install hatch | |
- name: Test | |
run: hatch run test | |
working-directory: ${{ matrix.d }} | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY || 'sk-000000000000000000000000000000000000000000000000' }} | |
spelling: | |
name: Spell check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Spell Check Repo | |
uses: crate-ci/typos@master | |
pre-commit: | |
name: Pre-commit | |
runs-on: ubuntu-latest | |
env: | |
PRE_COMMIT_HOME: ${{ github.workspace }}/.pre-commit | |
steps: | |
- uses: actions/checkout@v4 | |
# Cache PRE_COMMIT_HOME | |
- name: Cache pre-commit | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.PRE_COMMIT_HOME }} | |
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pre-commit- | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
committed: | |
name: Committed | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: committed-action | |
uses: crate-ci/committed@608423fab72842b4be0be432ca0591337fc85698 # v1.1.1 |