openai/openai-python
Publicmirrored fromhttps://github.com/openai/openai-pythonAvailable
.github/workflows/ci.yml
125lines · modecode
| 1 | name: CI |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
| 5 | - '**' |
| 6 | - '!integrated/**' |
| 7 | - '!stl-preview-head/**' |
| 8 | - '!stl-preview-base/**' |
| 9 | - '!generated' |
| 10 | - '!codegen/**' |
| 11 | - 'codegen/stl/**' |
| 12 | pull_request: |
| 13 | branches-ignore: |
| 14 | - 'stl-preview-head/**' |
| 15 | - 'stl-preview-base/**' |
| 16 | |
| 17 | jobs: |
| 18 | lint: |
| 19 | timeout-minutes: 10 |
| 20 | name: lint |
| 21 | runs-on: ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 22 | if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') |
| 23 | steps: |
| 24 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 25 | |
| 26 | - name: Set up Rye |
| 27 | uses: eifinger/setup-rye@c694239a43768373e87d0103d7f547027a23f3c8 |
| 28 | with: |
| 29 | version: '0.44.0' |
| 30 | enable-cache: true |
| 31 | |
| 32 | - name: Install dependencies |
| 33 | run: rye sync --all-features |
| 34 | |
| 35 | - name: Run lints |
| 36 | run: ./scripts/lint |
| 37 | |
| 38 | build: |
| 39 | if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') |
| 40 | timeout-minutes: 10 |
| 41 | name: build |
| 42 | permissions: |
| 43 | contents: read |
| 44 | id-token: write |
| 45 | runs-on: ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 46 | steps: |
| 47 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 48 | |
| 49 | - name: Set up Rye |
| 50 | uses: eifinger/setup-rye@c694239a43768373e87d0103d7f547027a23f3c8 |
| 51 | with: |
| 52 | version: '0.44.0' |
| 53 | enable-cache: true |
| 54 | |
| 55 | - name: Install dependencies |
| 56 | run: rye sync --all-features |
| 57 | |
| 58 | - name: Run build |
| 59 | run: rye build |
| 60 | |
| 61 | - name: Get GitHub OIDC Token |
| 62 | if: |- |
| 63 | github.repository == 'stainless-sdks/openai-python' && |
| 64 | !startsWith(github.ref, 'refs/heads/stl/') |
| 65 | id: github-oidc |
| 66 | uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 |
| 67 | with: |
| 68 | script: core.setOutput('github_token', await core.getIDToken()); |
| 69 | |
| 70 | - name: Upload tarball |
| 71 | if: |- |
| 72 | github.repository == 'stainless-sdks/openai-python' && |
| 73 | !startsWith(github.ref, 'refs/heads/stl/') |
| 74 | env: |
| 75 | URL: https://pkg.stainless.com/s |
| 76 | AUTH: ${{ steps.github-oidc.outputs.github_token }} |
| 77 | SHA: ${{ github.sha }} |
| 78 | run: ./scripts/utils/upload-artifact.sh |
| 79 | |
| 80 | test: |
| 81 | timeout-minutes: 10 |
| 82 | name: test |
| 83 | runs-on: ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 84 | if: github.event_name == 'push' || github.event.pull_request.head.repo.fork |
| 85 | steps: |
| 86 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 87 | |
| 88 | - name: Set up Rye |
| 89 | uses: eifinger/setup-rye@c694239a43768373e87d0103d7f547027a23f3c8 |
| 90 | with: |
| 91 | version: '0.44.0' |
| 92 | enable-cache: true |
| 93 | |
| 94 | - name: Bootstrap |
| 95 | run: ./scripts/bootstrap |
| 96 | |
| 97 | - name: Run tests |
| 98 | run: ./scripts/test |
| 99 | |
| 100 | examples: |
| 101 | timeout-minutes: 10 |
| 102 | name: examples |
| 103 | runs-on: ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 104 | if: github.repository == 'openai/openai-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') |
| 105 | |
| 106 | steps: |
| 107 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 108 | |
| 109 | - name: Set up Rye |
| 110 | uses: eifinger/setup-rye@c694239a43768373e87d0103d7f547027a23f3c8 |
| 111 | with: |
| 112 | version: '0.44.0' |
| 113 | enable-cache: true |
| 114 | - name: Install dependencies |
| 115 | run: | |
| 116 | rye sync --all-features |
| 117 | |
| 118 | - env: |
| 119 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 120 | run: | |
| 121 | rye run python examples/demo.py |
| 122 | - env: |
| 123 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 124 | run: | |
| 125 | rye run python examples/async_demo.py |
| 126 | |