|
| 1 | +name: CI |
| 2 | +on: |
| 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 | + |
| 15 | +jobs: |
| 16 | + lint: |
| 17 | + timeout-minutes: 10 |
| 18 | + name: lint |
| 19 | + runs-on: ${{ github.repository == 'stainless-sdks/gradient-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@v4 |
| 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/gradient-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 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: github.repository == 'stainless-sdks/gradient-python' |
| 65 | + id: github-oidc |
| 66 | + uses: actions/github-script@v8 |
| 67 | + with: |
| 68 | + script: core.setOutput('github_token', await core.getIDToken()); |
| 69 | + |
| 70 | + - name: Upload tarball |
| 71 | + if: github.repository == 'stainless-sdks/gradient-python' |
| 72 | + env: |
| 73 | + URL: https://pkg.stainless.com/s |
| 74 | + AUTH: ${{ steps.github-oidc.outputs.github_token }} |
| 75 | + SHA: ${{ github.sha }} |
| 76 | + run: ./scripts/utils/upload-artifact.sh |
| 77 | + |
| 78 | + test: |
| 79 | + timeout-minutes: 10 |
| 80 | + name: test |
| 81 | + runs-on: ${{ github.repository == 'stainless-sdks/gradient-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 82 | + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + |
| 86 | + - name: Install Rye |
| 87 | + run: | |
| 88 | + curl -sSf https://rye.astral.sh/get | bash |
| 89 | + echo "$HOME/.rye/shims" >> "$GITHUB_PATH" |
| 90 | + env: |
| 91 | + RYE_VERSION: "0.44.0" |
| 92 | + RYE_INSTALL_OPTION: "--yes" |
| 93 | + |
| 94 | + - name: Bootstrap |
| 95 | + run: ./scripts/bootstrap |
| 96 | + |
| 97 | + - name: Run tests |
| 98 | + run: ./scripts/test |
| 99 | + |
| 100 | + smoke: |
| 101 | + name: smoke |
| 102 | + # Only run smoke tests on pushes to main repo (not forks) so that secrets can be accessed |
| 103 | + if: github.repository == 'stainless-sdks/gradient-python' && github.event_name == 'push' |
| 104 | + runs-on: ${{ github.repository == 'stainless-sdks/gradient-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 105 | + timeout-minutes: 10 |
| 106 | + steps: |
| 107 | + - uses: actions/checkout@v4 |
| 108 | + |
| 109 | + - name: Install Rye |
| 110 | + run: | |
| 111 | + curl -sSf https://rye.astral.sh/get | bash |
| 112 | + echo "$HOME/.rye/shims" >> "$GITHUB_PATH" |
| 113 | + env: |
| 114 | + RYE_VERSION: "0.44.0" |
| 115 | + RYE_INSTALL_OPTION: "--yes" |
| 116 | + |
| 117 | + - name: Bootstrap |
| 118 | + run: ./scripts/bootstrap |
| 119 | + |
| 120 | + - name: Run smoke tests |
| 121 | + env: |
| 122 | + DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} |
| 123 | + GRADIENT_MODEL_ACCESS_KEY: ${{ secrets.GRADIENT_MODEL_ACCESS_KEY }} |
| 124 | + GRADIENT_AGENT_ACCESS_KEY: ${{ secrets.GRADIENT_AGENT_ACCESS_KEY }} |
| 125 | + GRADIENT_AGENT_ENDPOINT: ${{ secrets.GRADIENT_AGENT_ENDPOINT }} |
| 126 | + run: ./scripts/smoke |
0 commit comments