|
| 1 | +# Maintained in moderation-api/sdk-generator (custom/ruby). Edits here are overwritten. |
1 | 2 | name: CI |
2 | 3 | on: |
3 | 4 | push: |
4 | | - branches: |
5 | | - - '**' |
6 | | - - '!integrated/**' |
7 | | - - '!stl-preview-head/**' |
8 | | - - '!stl-preview-base/**' |
9 | | - - '!generated' |
10 | | - - '!codegen/**' |
11 | | - - 'codegen/stl/**' |
| 5 | + branches: [main] |
12 | 6 | pull_request: |
13 | | - branches-ignore: |
14 | | - - 'stl-preview-head/**' |
15 | | - - 'stl-preview-base/**' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
16 | 10 |
|
17 | 11 | jobs: |
18 | 12 | build: |
19 | | - timeout-minutes: 10 |
20 | | - name: build |
21 | | - permissions: |
22 | | - contents: read |
23 | | - id-token: write |
24 | | - runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
25 | | - if: |- |
26 | | - github.repository == 'stainless-sdks/moderation-api-ruby' && |
27 | | - (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') |
| 13 | + runs-on: ubuntu-latest |
28 | 14 | steps: |
29 | 15 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
30 | | - - name: Set up Ruby |
31 | | - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 |
| 16 | + - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 |
32 | 17 | with: |
| 18 | + ruby-version: "3.2" |
33 | 19 | bundler-cache: false |
34 | | - - run: |- |
35 | | - bundle install |
36 | | -
|
37 | | - - name: Get GitHub OIDC Token |
38 | | - if: |- |
39 | | - github.repository == 'stainless-sdks/moderation-api-ruby' && |
40 | | - !startsWith(github.ref, 'refs/heads/stl/') |
41 | | - id: github-oidc |
42 | | - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
43 | | - with: |
44 | | - script: core.setOutput('github_token', await core.getIDToken()); |
45 | | - |
46 | | - - name: Build and upload gem artifacts |
47 | | - if: |- |
48 | | - github.repository == 'stainless-sdks/moderation-api-ruby' && |
49 | | - !startsWith(github.ref, 'refs/heads/stl/') |
50 | | - env: |
51 | | - URL: https://pkg.stainless.com/s |
52 | | - AUTH: ${{ steps.github-oidc.outputs.github_token }} |
53 | | - SHA: ${{ github.sha }} |
54 | | - PACKAGE_NAME: moderation_api |
55 | | - run: ./scripts/utils/upload-artifact.sh |
56 | | - lint: |
57 | | - timeout-minutes: 10 |
58 | | - name: lint |
59 | | - runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
60 | | - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork |
61 | | - |
62 | | - steps: |
63 | | - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
64 | | - - name: Set up Ruby |
65 | | - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 |
66 | | - with: |
67 | | - bundler-cache: false |
68 | | - - run: |- |
69 | | - bundle install |
70 | | -
|
71 | | - - name: Run lints |
72 | | - run: ./scripts/lint |
73 | | - test: |
74 | | - timeout-minutes: 10 |
75 | | - name: test |
76 | | - runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} |
77 | | - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork |
78 | | - steps: |
79 | | - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
80 | | - - name: Set up Ruby |
81 | | - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 |
82 | | - with: |
83 | | - bundler-cache: false |
84 | | - - run: |- |
85 | | - bundle install |
86 | | -
|
87 | | - - name: Run tests |
88 | | - run: ./scripts/test |
| 20 | + - run: bundle install |
| 21 | + - run: bundle exec rubocop --format github |
| 22 | + - run: gem build moderation_api.gemspec |
| 23 | + - name: Load the gem |
| 24 | + run: bundle exec ruby -Ilib -e 'require "moderation_api"; require "moderation_api/webhook_signature"; ModerationApi::ModerationApi; ModerationApi::WebhookSignature' |
0 commit comments