github.com/anthropics/anthropic-sdk-go@v1.70.1/.github/workflows/ci.yml (about) 1 name: CI 2 on: 3 push: 4 branches: 5 - '**' 6 - '!integrated/**' 7 - '!stl-preview-head/**' 8 - '!stl-preview-base/**' 9 - '!generated' 10 - '!codegen/**' 11 - 'codegen/stl/**' 12 pull_request: 13 branches-ignore: 14 - 'stl-preview-head/**' 15 - 'stl-preview-base/**' 16 17 concurrency: 18 group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }} 19 cancel-in-progress: true 20 21 jobs: 22 build: 23 timeout-minutes: 10 24 name: build 25 permissions: 26 contents: read 27 id-token: write 28 runs-on: 'ubuntu-latest' 29 if: |- 30 github.repository == 'anthropics/anthropic-sdk-go-private' && 31 (github.event_name == 'push' || github.event.pull_request.head.repo.fork) 32 steps: 33 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 34 35 - name: Get GitHub OIDC Token 36 if: |- 37 github.repository == 'anthropics/anthropic-sdk-go-private' && 38 !startsWith(github.ref, 'refs/heads/stl/') 39 id: github-oidc 40 uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 41 with: 42 script: core.setOutput('github_token', await core.getIDToken()); 43 44 - name: Upload tarball 45 if: |- 46 github.repository == 'anthropics/anthropic-sdk-go-private' && 47 !startsWith(github.ref, 'refs/heads/stl/') 48 env: 49 URL: https://pkg.stainless.com/s 50 AUTH: ${{ steps.github-oidc.outputs.github_token }} 51 SHA: ${{ github.sha }} 52 run: ./scripts/utils/upload-artifact.sh 53 lint: 54 timeout-minutes: 10 55 name: lint 56 runs-on: 'ubuntu-latest' 57 if: github.event_name == 'push' || github.event.pull_request.head.repo.fork 58 59 steps: 60 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 61 62 - name: Setup go 63 uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 64 with: 65 go-version-file: ./go.mod 66 67 - name: Run lints 68 run: ./scripts/lint 69 test: 70 timeout-minutes: 10 71 name: test 72 runs-on: 'ubuntu-latest' 73 if: github.event_name == 'push' || github.event.pull_request.head.repo.fork 74 steps: 75 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 76 77 - name: Setup go 78 uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 79 with: 80 go-version-file: ./go.mod 81 82 - name: Bootstrap 83 run: ./scripts/bootstrap 84 85 - name: Run tests 86 run: ./scripts/test 87 88 detect_breaking_changes: 89 timeout-minutes: 10 90 name: detect-breaking-changes 91 runs-on: 'ubuntu-latest' 92 if: |- 93 (github.event_name == 'push' && 94 !startsWith(github.ref, 'refs/heads/release-please--')) || 95 github.event.pull_request.head.repo.fork 96 steps: 97 # fetch-depth: 0 fetches full commit history (all branches and 98 # tags, so the base ref is available) so `git merge-base` 99 # below can resolve the fork point. filter: blob:none keeps the 100 # fetch cheap: commit metadata is downloaded eagerly, file blobs 101 # only when a later `git checkout` asks for them. 102 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 103 with: 104 fetch-depth: 0 105 filter: blob:none 106 107 - name: Setup go 108 uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 109 with: 110 go-version-file: ./go.mod 111 112 - name: Determine base SHA 113 run: | 114 # A breaking-change-baseline tag, when the repo keeps one, marks the API 115 # surface to compare against; it is moved by force, so refetch it. 116 git fetch --quiet --force origin '+refs/tags/breaking-change-baseline:refs/tags/breaking-change-baseline' 2>/dev/null || true 117 if git rev-parse --quiet --verify 'refs/tags/breaking-change-baseline^{commit}' >/dev/null; then 118 BASE_REF='refs/tags/breaking-change-baseline' 119 elif git rev-parse --quiet --verify 'origin/main^{commit}' >/dev/null; then 120 BASE_REF='origin/main' 121 else 122 echo 'No breaking-change-baseline tag or origin/main to compare against; skipping.' 123 echo "BASE_SHA=" >> "$GITHUB_ENV" 124 exit 0 125 fi 126 echo "Comparing against $BASE_REF" 127 BASE_SHA=$(git merge-base HEAD "$BASE_REF" 2>/dev/null || echo "") 128 echo "BASE_SHA=$BASE_SHA" >> "$GITHUB_ENV" 129 130 - name: Detect breaking changes 131 if: env.BASE_SHA != '' 132 run: | 133 # Try to check out previous versions of the breaking change detection script. This ensures that 134 # we still detect breaking changes when entire files and their tests are removed. 135 git checkout "$BASE_SHA" -- ./scripts/detect-breaking-changes 2>/dev/null || true 136 ./scripts/detect-breaking-changes "$BASE_SHA"