-
Notifications
You must be signed in to change notification settings - Fork 125
140 lines (114 loc) · 4.42 KB
/
Copy pathci.yml
File metadata and controls
140 lines (114 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
id-token: write
contents: read
env:
ARTIFACTORY_URL: ${{ vars.ARTIFACTORY_URL }}
jobs:
lint:
name: Lint
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'ubuntu-x64' }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Ruby
uses: ./.github/actions/setup-ruby
with:
ruby-version: '3.3'
- name: Restore gem cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: vendor/bundle
key: bundle-${{ runner.os }}-ruby3.3-${{ hashFiles('Gemfile.lock') }}
restore-keys: bundle-${{ runner.os }}-ruby3.3-
- name: Authenticate with Artifactory
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: twilio/sdk-actions/artifactory-oidc@c94e420aa64ea686ff25bb03d4c66cdaf8e523e4 # main
with:
ecosystem: ruby
provider-name: github-actions-segmentio
- name: Install dependencies
run: |
bundle config set --local path vendor/bundle
bundle install --jobs 4
- name: Run RuboCop
run: bundle exec rubocop
test:
name: Test (Ruby ${{ matrix.ruby-version }})
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'ubuntu-x64' }}
strategy:
fail-fast: false
matrix:
# Bounded by what the runner image caches — see .github/actions/setup-ruby.
# 3.1 left upstream support in March 2025 and the image does not carry it.
# 3.4 is cached and selectable, but activesupport 5.2 (a test-only dep)
# requires base64, which 3.4 removed from the default gems. Adding the
# base64 gem and regenerating Gemfile.lock would admit it.
ruby-version: ['3.2', '3.3']
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Ruby
uses: ./.github/actions/setup-ruby
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Restore gem cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: vendor/bundle
key: bundle-${{ runner.os }}-ruby${{ matrix.ruby-version }}-${{ hashFiles('Gemfile.lock') }}
restore-keys: bundle-${{ runner.os }}-ruby${{ matrix.ruby-version }}-
- name: Authenticate with Artifactory
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: twilio/sdk-actions/artifactory-oidc@c94e420aa64ea686ff25bb03d4c66cdaf8e523e4 # main
with:
ecosystem: ruby
provider-name: github-actions-segmentio
- name: Install dependencies
run: |
bundle config set --local path vendor/bundle
bundle install --jobs 4
- name: Run tests
run: bundle exec rake
build:
name: Build
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'ubuntu-x64' }}
needs: [lint, test]
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Ruby
uses: ./.github/actions/setup-ruby
with:
ruby-version: '3.3'
- name: Restore gem cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: vendor/bundle
key: bundle-${{ runner.os }}-ruby3.3-${{ hashFiles('Gemfile.lock') }}
restore-keys: bundle-${{ runner.os }}-ruby3.3-
- name: Authenticate with Artifactory
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: twilio/sdk-actions/artifactory-oidc@c94e420aa64ea686ff25bb03d4c66cdaf8e523e4 # main
with:
ecosystem: ruby
provider-name: github-actions-segmentio
- name: Install dependencies
run: |
bundle config set --local path vendor/bundle
bundle install --jobs 4
- name: Build gem
run: gem build analytics-ruby.gemspec
- name: Verify gem is installable
run: gem install ./analytics-ruby-*.gem
- name: Upload gem artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: analytics-ruby-gem
path: analytics-ruby-*.gem
if-no-files-found: error