openai/openai-java

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.37.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/ci.yml

162lines · modeblame

af9f9a27Robert Craigie2 years ago1name: CI
2on:
3push:
4826c31fstainless-app[bot]5 months ago4branches:
5- '**'
6- '!integrated/**'
7- '!stl-preview-head/**'
8- '!stl-preview-base/**'
9- '!generated'
10- '!codegen/**'
11- 'codegen/stl/**'
9c90b165stainless-app[bot]1 years ago12pull_request:
13branches-ignore:
14- 'stl-preview-head/**'
15- 'stl-preview-base/**'
af9f9a27Robert Craigie2 years ago16
17jobs:
18lint:
984e85d1stainless-app[bot]1 years ago19timeout-minutes: 15
af9f9a27Robert Craigie2 years ago20name: lint
3c78e3a5stainless-app[bot]1 years ago21runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
a84c5886stainless-app[bot]4 months ago22if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
3c78e3a5stainless-app[bot]1 years ago23
af9f9a27Robert Craigie2 years ago24steps:
3349f806Drew Hintz4 months ago25- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
af9f9a27Robert Craigie2 years ago26
27- name: Set up Java
3349f806Drew Hintz4 months ago28uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
af9f9a27Robert Craigie2 years ago29with:
30distribution: temurin
31java-version: |
328
3c78e3a5stainless-app[bot]1 years ago3321
af9f9a27Robert Craigie2 years ago34cache: gradle
35
36- name: Set up Gradle
3349f806Drew Hintz4 months ago37uses: gradle/actions/setup-gradle@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4
af9f9a27Robert Craigie2 years ago38
39- name: Run lints
40run: ./scripts/lint
b4c700e7stainless-app[bot]1 years ago41
42build:
38f3e8c3Alex Chang5 months ago43timeout-minutes: 30
b4c700e7stainless-app[bot]1 years ago44name: build
de8d6db6stainless-app[bot]6 months ago45permissions:
46contents: read
47id-token: write
b4c700e7stainless-app[bot]1 years ago48runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
a84c5886stainless-app[bot]4 months ago49if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
b4c700e7stainless-app[bot]1 years ago50
51steps:
3349f806Drew Hintz4 months ago52- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
b4c700e7stainless-app[bot]1 years ago53
54- name: Set up Java
3349f806Drew Hintz4 months ago55uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
b4c700e7stainless-app[bot]1 years ago56with:
57distribution: temurin
58java-version: |
598
6021
61cache: gradle
62
63- name: Set up Gradle
3349f806Drew Hintz4 months ago64uses: gradle/actions/setup-gradle@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d # v4
b4c700e7stainless-app[bot]1 years ago65
66- name: Build SDK
dae306e5stainless-app[bot]10 months ago67# disable gradle daemon in CI because it is flakey
68env:
69GRADLE_OPTS: "-Dkotlin.compiler.execution.strategy=in-process"
b4c700e7stainless-app[bot]1 years ago70run: ./scripts/build
71
de8d6db6stainless-app[bot]6 months ago72- name: Build and upload Maven artifacts
a22b2164stainless-app[bot]5 months ago73if: |-
74github.repository == 'stainless-sdks/openai-java' &&
75!startsWith(github.ref, 'refs/heads/stl/')
de8d6db6stainless-app[bot]6 months ago76env:
77URL: https://pkg.stainless.com/s
78SHA: ${{ github.sha }}
79PROJECT: openai-java
e4a9a321Alex Chang5 months ago80run: |
81set -euo pipefail
82
83max_retries=5
84attempt=1
85
86while true; do
87echo "Maven artifact upload attempt ${attempt}/${max_retries}"
88
89oidc_response="$(curl -sSf \
90-H "Authorization: bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" \
91"${ACTIONS_ID_TOKEN_REQUEST_URL}")"
92github_token="$(printf '%s' "$oidc_response" | jq -er '.value')"
93
94upload_log="$(mktemp)"
95set +e
96AUTH="$github_token" ./scripts/upload-artifacts 2>&1 | tee "$upload_log"
97upload_status=${PIPESTATUS[0]}
98set -e
99
100if [ "$upload_status" -eq 0 ]; then
101break
102fi
103
104if [ "$attempt" -lt "$max_retries" ] && \
105grep -q "Failed to get valid signed URL" "$upload_log" && \
106grep -q "GitHub JWT is missing or invalid\\." "$upload_log"; then
107sleep_seconds=$((3 * (1 << (attempt - 1))))
108echo "Retrying after fresh OIDC token due to transient GitHub JWT validation failure"
109echo "Sleeping ${sleep_seconds}s before retry"
110sleep "$sleep_seconds"
111attempt=$((attempt + 1))
112continue
113fi
114
115exit "$upload_status"
116done
7a8cd60aStainless Bot2 years ago117test:
38f3e8c3Alex Chang5 months ago118timeout-minutes: 30
7a8cd60aStainless Bot2 years ago119name: test
3c78e3a5stainless-app[bot]1 years ago120runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
d8b19b7estainless-app[bot]1 years ago121if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
7a8cd60aStainless Bot2 years ago122steps:
3349f806Drew Hintz4 months ago123- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
7a8cd60aStainless Bot2 years ago124
125- name: Set up Java
3349f806Drew Hintz4 months ago126uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
7a8cd60aStainless Bot2 years ago127with:
128distribution: temurin
129java-version: |
1308
3c78e3a5stainless-app[bot]1 years ago13121
7a8cd60aStainless Bot2 years ago132cache: gradle
133
134- name: Set up Gradle
3349f806Drew Hintz4 months ago135uses: gradle/gradle-build-action@fe583dc97e032f41ccc310ea5176f2d7306abbc4 # v2
7a8cd60aStainless Bot2 years ago136
137- name: Run tests
138run: ./scripts/test
cdf6cd11stainless-app[bot]1 years ago139examples:
fafcb2d0Alex Chang3 months ago140timeout-minutes: 20
cdf6cd11stainless-app[bot]1 years ago141name: examples
3c78e3a5stainless-app[bot]1 years ago142runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
a84c5886stainless-app[bot]4 months ago143if: github.repository == 'openai/openai-java' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
cdf6cd11stainless-app[bot]1 years ago144
145steps:
3349f806Drew Hintz4 months ago146- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
cdf6cd11stainless-app[bot]1 years ago147
148- name: Set up Java
3349f806Drew Hintz4 months ago149uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
cdf6cd11stainless-app[bot]1 years ago150with:
151distribution: temurin
152java-version: |
1538
3c78e3a5stainless-app[bot]1 years ago15421
cdf6cd11stainless-app[bot]1 years ago155cache: gradle
156- name: Set up Gradle
3349f806Drew Hintz4 months ago157uses: gradle/gradle-build-action@fe583dc97e032f41ccc310ea5176f2d7306abbc4 # v2
af9f9a27Robert Craigie2 years ago158
cdf6cd11stainless-app[bot]1 years ago159- env:
160OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
161run: |
162./gradlew :openai-java-example:run