-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore(ci): setup automated stainless builds #3557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dgellow
wants to merge
1
commit into
llamastack:main
Choose a base branch
from
stainless-api:dgellow/add-stainless-workflows
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Stainless SDK Builds | ||
|
||
run-name: Build Stainless SDKs | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- closed | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
# Stainless organization name. | ||
STAINLESS_ORG: llamastack | ||
|
||
# Stainless project name. | ||
STAINLESS_PROJECT: llama-stack-client | ||
|
||
# Path to your OpenAPI spec. | ||
OAS_PATH: ./docs/static/llama-stack-spec.yaml | ||
|
||
# Path to your Stainless config. Optional; only provide this if you prefer | ||
# to maintain the ground truth Stainless config in your own repo. | ||
CONFIG_PATH: ./docs/static/stainless-config.yaml | ||
|
||
# When to fail the job based on build conclusion. | ||
# Options: "never" | "note" | "warning" | "error" | "fatal". | ||
FAIL_ON: error | ||
|
||
jobs: | ||
preview: | ||
if: github.event.action != 'closed' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Run preview builds | ||
uses: stainless-api/upload-openapi-spec-action/preview@b741c27bc604e5c130b92ed4056b07aee783aa04 # v1.5.4 | ||
with: | ||
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} | ||
org: ${{ env.STAINLESS_ORG }} | ||
project: ${{ env.STAINLESS_PROJECT }} | ||
oas_path: ${{ env.OAS_PATH }} | ||
config_path: ${{ env.CONFIG_PATH }} | ||
fail_on: ${{ env.FAIL_ON }} | ||
make_comment: true | ||
commit_message: "feat(api): preview build for PR #${{ inputs.pr_number }}" | ||
|
||
merge: | ||
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
with: | ||
fetch-depth: 2 | ||
|
||
# Note that this only merges in changes that happened on the last build on | ||
# preview/${{ github.head_ref }}. It's possible that there are OAS/config | ||
# changes that haven't been built, if the preview-sdk job didn't finish | ||
# before this step starts. In theory we want to wait for all builds | ||
# against preview/${{ github.head_ref }} to complete, but assuming that | ||
# the preview-sdk job happens before the PR merge, it should be fine. | ||
- name: Run merge build | ||
uses: stainless-api/upload-openapi-spec-action/merge@b741c27bc604e5c130b92ed4056b07aee783aa04 # v1.5.4 | ||
with: | ||
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} | ||
org: ${{ env.STAINLESS_ORG }} | ||
project: ${{ env.STAINLESS_PROJECT }} | ||
oas_path: ${{ env.OAS_PATH }} | ||
config_path: ${{ env.CONFIG_PATH }} | ||
fail_on: ${{ env.FAIL_ON }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would other option be? is this maintained in the
stainless-sdk
repo?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 2 options are:
stainless-sdks/*-config
repo is the source of truth, and the SDK Studio is the expected way to edit it.The option 1 gives you the most control and lets you use the tooling you prefer. I would recommend it if you expect multiple teams/people to work on the files at the same time, having the config in your PRs makes it simpler to coordinate concurrent work. On the other hand, the option 2 expects that you're using the web editor which is tightly integrated in the rest of the web app.
In both cases files will eventually find their way into the
stainless-sdks/*-config
repo, which is used as inputs for the codegen process.Does that make sense?