README updates and CI fixes #712
Workflow file for this run
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: Continuous Integration | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- "releases/*" | |
jobs: | |
# Build and test the project | |
build-lint-test: | |
strategy: | |
fail-fast: true | |
matrix: | |
python: ["3.7", "3.11"] | |
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-arm] | |
include: | |
- os: ubuntu-latest | |
python: "3.11" | |
docsTarget: true | |
- os: ubuntu-latest | |
python: "3.7" | |
protoCheckTarget: true | |
- os: ubuntu-arm | |
runsOn: buildjet-4vcpu-ubuntu-2204-arm | |
runs-on: ${{ matrix.runsOn || matrix.os }} | |
# For Windows there is currently a bug with Windows + pytest + warnings + | |
# importlib + Python < 3.12. Based on others' investigations, disabling | |
# bytecode fixes it. | |
# See https://github.com/temporalio/sdk-python/pull/346#issuecomment-1636108747 | |
env: | |
PYTHONDONTWRITEBYTECODE: "${{ matrix.os == 'windows-latest' && '1' || '' }}" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
working-directory: temporalio/bridge | |
# actions/setup-python doesn't yet support ARM | |
- if: ${{ !endsWith(matrix.os, '-arm') }} | |
uses: actions/setup-python@v4 | |
with: | |
# Due to a yet-uninvestigated change in 3.11.6 that breaks the Rust | |
# linker on Windows, we are pinning 3.11 to 3.11.5 here | |
python-version: ${{ matrix.python == '3.11' && '3.11.5' || matrix.python }} | |
- if: ${{ matrix.os == 'ubuntu-arm' }} | |
uses: deadsnakes/[email protected] | |
with: | |
python-version: ${{ matrix.python }} | |
# Using fixed Poetry version until | |
# https://github.com/python-poetry/poetry/issues/7611 and | |
# https://github.com/python-poetry/poetry/pull/7694 are fixed | |
- run: python -m pip install --upgrade wheel "poetry==1.3.2" poethepoet | |
- run: poetry install --no-root -E opentelemetry | |
- run: poe lint | |
- run: poe build-develop | |
- run: poe test -s -o log_cli_level=DEBUG | |
# Time skipping doesn't yet support ARM | |
- if: ${{ !endsWith(matrix.os, '-arm') }} | |
run: poe test -s -o log_cli_level=DEBUG --workflow-environment time-skipping | |
# Confirm protos are already generated properly with older protobuf | |
# library and run test with that older version. We must downgrade protobuf | |
# so we can generate 3.x and 4.x compatible API. We have to use older | |
# Python to run this check because the grpcio-tools version we use | |
# is <= 3.10. | |
- name: Check generated protos and test protobuf 3.x | |
if: ${{ matrix.protoCheckTarget }} | |
env: | |
TEMPORAL_TEST_PROTO3: 1 | |
run: | | |
poetry add "protobuf<4" | |
poe gen-protos | |
poe format | |
[[ -z $(git status --porcelain temporalio) ]] || (git diff; echo "Protos changed"; exit 1) | |
poe test -s -o log_cli_level=DEBUG | |
# Do docs stuff (only on one host) | |
- name: Build API docs | |
if: ${{ matrix.docsTarget }} | |
run: poe gen-docs | |
- name: Deploy prod API docs | |
if: ${{ github.ref == 'refs/heads/main' && matrix.docsTarget }} | |
run: npx vercel deploy build/apidocs -t ${{ secrets.VERCEL_TOKEN }} --name python --scope temporal --prod --yes | |
# Confirm README ToC is generated properly | |
- uses: actions/setup-node@v3 | |
- name: Check generated README ToC | |
if: ${{ matrix.docsTarget }} | |
run: | | |
npx doctoc README.md | |
[[ -z $(git status --porcelain README.md) ]] || (git diff README.md; echo "README changed"; exit 1) | |
# Runs the sdk features repo tests with this repo's current SDK code | |
features-tests: | |
uses: temporalio/features/.github/workflows/python.yaml@main | |
with: | |
python-repo-path: ${{github.event.pull_request.head.repo.full_name}} | |
version: ${{github.event.pull_request.head.ref}} | |
version-is-repo-ref: true |