openai/openai-python

Public

mirrored from https://github.com/openai/openai-pythonAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v2.27.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/ci.yml

131lines · modecode

1name: CI
2on:
3 push:
4 branches-ignore:
5 - 'generated'
6 - 'codegen/**'
7 - 'integrated/**'
8 - 'stl-preview-head/**'
9 - 'stl-preview-base/**'
10 pull_request:
11 branches-ignore:
12 - 'stl-preview-head/**'
13 - 'stl-preview-base/**'
14
15jobs:
16 lint:
17 timeout-minutes: 10
18 name: lint
19 runs-on: ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
20 if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
21 steps:
22 - uses: actions/checkout@v6
23
24 - name: Install Rye
25 run: |
26 curl -sSf https://rye.astral.sh/get | bash
27 echo "$HOME/.rye/shims" >> $GITHUB_PATH
28 env:
29 RYE_VERSION: '0.44.0'
30 RYE_INSTALL_OPTION: '--yes'
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
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@v6
48
49 - name: Install Rye
50 run: |
51 curl -sSf https://rye.astral.sh/get | bash
52 echo "$HOME/.rye/shims" >> $GITHUB_PATH
53 env:
54 RYE_VERSION: '0.44.0'
55 RYE_INSTALL_OPTION: '--yes'
56
57 - name: Install dependencies
58 run: rye sync --all-features
59
60 - name: Run build
61 run: rye build
62
63 - name: Get GitHub OIDC Token
64 if: |-
65 github.repository == 'stainless-sdks/openai-python' &&
66 !startsWith(github.ref, 'refs/heads/stl/')
67 id: github-oidc
68 uses: actions/github-script@v8
69 with:
70 script: core.setOutput('github_token', await core.getIDToken());
71
72 - name: Upload tarball
73 if: |-
74 github.repository == 'stainless-sdks/openai-python' &&
75 !startsWith(github.ref, 'refs/heads/stl/')
76 env:
77 URL: https://pkg.stainless.com/s
78 AUTH: ${{ steps.github-oidc.outputs.github_token }}
79 SHA: ${{ github.sha }}
80 run: ./scripts/utils/upload-artifact.sh
81
82 test:
83 timeout-minutes: 10
84 name: test
85 runs-on: ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
86 if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
87 steps:
88 - uses: actions/checkout@v6
89
90 - name: Install Rye
91 run: |
92 curl -sSf https://rye.astral.sh/get | bash
93 echo "$HOME/.rye/shims" >> $GITHUB_PATH
94 env:
95 RYE_VERSION: '0.44.0'
96 RYE_INSTALL_OPTION: '--yes'
97
98 - name: Bootstrap
99 run: ./scripts/bootstrap
100
101 - name: Run tests
102 run: ./scripts/test
103
104 examples:
105 timeout-minutes: 10
106 name: examples
107 runs-on: ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
108 if: github.repository == 'openai/openai-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
109
110 steps:
111 - uses: actions/checkout@v6
112
113 - name: Install Rye
114 run: |
115 curl -sSf https://rye.astral.sh/get | bash
116 echo "$HOME/.rye/shims" >> $GITHUB_PATH
117 env:
118 RYE_VERSION: '0.44.0'
119 RYE_INSTALL_OPTION: '--yes'
120 - name: Install dependencies
121 run: |
122 rye sync --all-features
123
124 - env:
125 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
126 run: |
127 rye run python examples/demo.py
128 - env:
129 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
130 run: |
131 rye run python examples/async_demo.py
132