|
| 1 | +name: Unit tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + working_directory: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + secrets: |
| 10 | + MODAL_TOKEN_ID: |
| 11 | + required: true |
| 12 | + modal_token_secret: |
| 13 | + required: true |
| 14 | + |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 18 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 19 | + |
| 20 | + client-test: |
| 21 | + name: Unit tests on ${{ matrix.python-version }} and ${{ matrix.os }} (protobuf=${{ matrix.proto-version }}) |
| 22 | + timeout-minutes: 30 |
| 23 | + |
| 24 | + strategy: |
| 25 | + fail-fast: false # run all variants across python versions/os to completion |
| 26 | + matrix: |
| 27 | + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
| 28 | + os: ["ubuntu-24.04"] |
| 29 | + proto-version: ["latest"] |
| 30 | + include: |
| 31 | + - os: "macos-15-intel" # x86-64 |
| 32 | + python-version: "3.10" |
| 33 | + proto-version: "latest" |
| 34 | + - os: "macos-15" # ARM64 (M1) |
| 35 | + python-version: "3.10" |
| 36 | + proto-version: "latest" |
| 37 | + - os: "windows-latest" |
| 38 | + python-version: "3.10" |
| 39 | + proto-version: "latest" |
| 40 | + - os: "ubuntu-24.04" |
| 41 | + python-version: "3.10" |
| 42 | + proto-version: "3.20" |
| 43 | + |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 |
| 47 | + |
| 48 | + - uses: ${{ inputs.working_directory }}/.github/actions/setup-cached-python |
| 49 | + with: |
| 50 | + version: ${{ matrix.python-version }} |
| 51 | + |
| 52 | + - if: matrix.proto-version != 'latest' |
| 53 | + name: Install protobuf |
| 54 | + run: uv pip install protobuf==${{ matrix.proto-version }} |
| 55 | + |
| 56 | + - name: Build protobuf |
| 57 | + run: inv protoc |
| 58 | + working-directory: ${{ inputs.working_directory }} |
| 59 | + |
| 60 | + - name: Build client package (installs all dependencies) |
| 61 | + run: uv pip install -e . |
| 62 | + working-directory: ${{ inputs.working_directory }} |
| 63 | + |
| 64 | + - name: Run client tests |
| 65 | + run: inv test |
| 66 | + working-directory: ${{ inputs.working_directory }} |
| 67 | + |
| 68 | + - name: Run docstring tests |
| 69 | + if: github.event.pull_request.head.repo.fork == false |
| 70 | + env: |
| 71 | + MODAL_ENVIRONMENT: client-doc-tests |
| 72 | + MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} |
| 73 | + MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} |
| 74 | + run: pytest -v --markdown-docs -m markdown-docs modal |
| 75 | + working-directory: ${{ inputs.working_directory }} |
0 commit comments