Skip to content

Commit 0dc7d00

Browse files
committed
chore(ci): setup automated stainless builds
1 parent b67aef2 commit 0dc7d00

File tree

3 files changed

+711
-0
lines changed

3 files changed

+711
-0
lines changed

.github/workflows/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Llama Stack uses GitHub Actions for Continuous Integration (CI). Below is a tabl
1616
| Python Package Build Test | [python-build-test.yml](python-build-test.yml) | Test building the llama-stack PyPI project |
1717
| Integration Tests (Record) | [record-integration-tests.yml](record-integration-tests.yml) | Run the integration test suite from tests/integration |
1818
| Check semantic PR titles | [semantic-pr.yml](semantic-pr.yml) | Ensure that PR titles follow the conventional commit spec |
19+
| Stainless SDK Builds | [stainless-builds.yml](stainless-builds.yml) | Build Stainless SDKs |
1920
| Close stale issues and PRs | [stale_bot.yml](stale_bot.yml) | Run the Stale Bot action |
2021
| Test External Providers Installed via Module | [test-external-provider-module.yml](test-external-provider-module.yml) | Test External Provider installation via Python module |
2122
| Test External API and Providers | [test-external.yml](test-external.yml) | Test the External API and Provider mechanisms |
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Stainless SDK Builds
2+
3+
run-name: Build Stainless SDKs
4+
5+
on:
6+
pull_request:
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
- closed
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
16+
17+
env:
18+
# Stainless organization name.
19+
STAINLESS_ORG: llamastack
20+
21+
# Stainless project name.
22+
STAINLESS_PROJECT: llama-stack-client
23+
24+
# Path to your OpenAPI spec.
25+
OAS_PATH: ./docs/static/llama-stack-spec.yaml
26+
27+
# Path to your Stainless config. Optional; only provide this if you prefer
28+
# to maintain the ground truth Stainless config in your own repo.
29+
CONFIG_PATH: ./docs/static/stainless-config.yaml
30+
31+
# When to fail the job based on build conclusion.
32+
# Options: "never" | "note" | "warning" | "error" | "fatal".
33+
FAIL_ON: error
34+
35+
jobs:
36+
preview:
37+
if: github.event.action != 'closed'
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: read
41+
pull-requests: write
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
45+
with:
46+
fetch-depth: 2
47+
48+
- name: Run preview builds
49+
uses: stainless-api/upload-openapi-spec-action/preview@b741c27bc604e5c130b92ed4056b07aee783aa04 # v1.5.4
50+
with:
51+
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
52+
org: ${{ env.STAINLESS_ORG }}
53+
project: ${{ env.STAINLESS_PROJECT }}
54+
oas_path: ${{ env.OAS_PATH }}
55+
config_path: ${{ env.CONFIG_PATH }}
56+
fail_on: ${{ env.FAIL_ON }}
57+
make_comment: true
58+
commit_message: "feat(api): preview build for PR #${{ inputs.pr_number }}"
59+
60+
merge:
61+
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
62+
runs-on: ubuntu-latest
63+
permissions:
64+
contents: read
65+
pull-requests: write
66+
steps:
67+
- name: Checkout repository
68+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
69+
with:
70+
fetch-depth: 2
71+
72+
# Note that this only merges in changes that happened on the last build on
73+
# preview/${{ github.head_ref }}. It's possible that there are OAS/config
74+
# changes that haven't been built, if the preview-sdk job didn't finish
75+
# before this step starts. In theory we want to wait for all builds
76+
# against preview/${{ github.head_ref }} to complete, but assuming that
77+
# the preview-sdk job happens before the PR merge, it should be fine.
78+
- name: Run merge build
79+
uses: stainless-api/upload-openapi-spec-action/merge@b741c27bc604e5c130b92ed4056b07aee783aa04 # v1.5.4
80+
with:
81+
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
82+
org: ${{ env.STAINLESS_ORG }}
83+
project: ${{ env.STAINLESS_PROJECT }}
84+
oas_path: ${{ env.OAS_PATH }}
85+
config_path: ${{ env.CONFIG_PATH }}
86+
fail_on: ${{ env.FAIL_ON }}

0 commit comments

Comments
 (0)