cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
.github/workflows/ci.yml
128lines · modecode
| 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 }} |
| 19 | cancel-in-progress: true |
| 20 | |
| 21 | jobs: |
| 22 | lint: |
| 23 | timeout-minutes: 10 |
| 24 | name: lint |
| 25 | runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 26 | if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') |
| 27 | permissions: |
| 28 | contents: read |
| 29 | steps: |
| 30 | - uses: actions/checkout@v6 |
| 31 | |
| 32 | - name: Set up Node |
| 33 | uses: actions/setup-node@v4 |
| 34 | with: |
| 35 | node-version: '18' |
| 36 | |
| 37 | - name: Bootstrap |
| 38 | run: ./scripts/bootstrap |
| 39 | |
| 40 | - name: Check types |
| 41 | run: ./scripts/lint |
| 42 | |
| 43 | build: |
| 44 | timeout-minutes: 5 |
| 45 | name: build |
| 46 | runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 47 | if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') |
| 48 | permissions: |
| 49 | contents: read |
| 50 | id-token: write |
| 51 | steps: |
| 52 | - uses: actions/checkout@v6 |
| 53 | |
| 54 | - name: Set up Node |
| 55 | uses: actions/setup-node@v4 |
| 56 | with: |
| 57 | node-version: '18' |
| 58 | |
| 59 | - name: Bootstrap |
| 60 | run: ./scripts/bootstrap |
| 61 | |
| 62 | - name: Check build |
| 63 | run: ./scripts/build |
| 64 | |
| 65 | - name: Get GitHub OIDC Token |
| 66 | if: |- |
| 67 | github.repository == 'stainless-sdks/cloudflare-node' && |
| 68 | !startsWith(github.ref, 'refs/heads/stl/') |
| 69 | id: github-oidc |
| 70 | uses: actions/github-script@v8 |
| 71 | with: |
| 72 | script: core.setOutput('github_token', await core.getIDToken()); |
| 73 | |
| 74 | - name: Upload tarball |
| 75 | if: |- |
| 76 | github.repository == 'stainless-sdks/cloudflare-node' && |
| 77 | !startsWith(github.ref, 'refs/heads/stl/') |
| 78 | env: |
| 79 | URL: https://pkg.stainless.com/s |
| 80 | AUTH: ${{ steps.github-oidc.outputs.github_token }} |
| 81 | SHA: ${{ github.sha }} |
| 82 | run: ./scripts/utils/upload-artifact.sh |
| 83 | test: |
| 84 | timeout-minutes: 10 |
| 85 | name: test |
| 86 | runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 87 | if: github.event_name == 'push' || github.event.pull_request.head.repo.fork |
| 88 | permissions: |
| 89 | contents: read |
| 90 | steps: |
| 91 | - uses: actions/checkout@v6 |
| 92 | |
| 93 | - name: Set up Node |
| 94 | uses: actions/setup-node@v4 |
| 95 | with: |
| 96 | node-version: '20' |
| 97 | |
| 98 | - name: Bootstrap |
| 99 | run: ./scripts/bootstrap |
| 100 | |
| 101 | - name: Run tests |
| 102 | continue-on-error: true |
| 103 | run: ./scripts/test |
| 104 | examples: |
| 105 | timeout-minutes: 10 |
| 106 | name: examples |
| 107 | runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
| 108 | if: github.repository == 'cloudflare/cloudflare-typescript' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') |
| 109 | permissions: |
| 110 | contents: read |
| 111 | steps: |
| 112 | - uses: actions/checkout@v6 |
| 113 | |
| 114 | - name: Set up Node |
| 115 | uses: actions/setup-node@v4 |
| 116 | with: |
| 117 | node-version: '20' |
| 118 | - name: Install dependencies |
| 119 | run: | |
| 120 | yarn install |
| 121 | |
| 122 | - env: |
| 123 | CLOUDFLARE_ACCOUNT_ID: f037e56e89293a057740de681ac9abbe |
| 124 | CLOUDFLARE_EMAIL: terraform-acceptance-test@cfapi.net |
| 125 | CLOUDFLARE_ZONE_ID: 0da42c8d2132a9ddaf714f9e7c92011 |
| 126 | CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} |
| 127 | run: | |
| 128 | yarn tsn ./examples/ai/demo.ts |
| 129 | |