-
Notifications
You must be signed in to change notification settings - Fork 8
210 lines (192 loc) · 6.83 KB
/
Copy pathrelease_ruby_gem.yml
File metadata and controls
210 lines (192 loc) · 6.83 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
---
name: Release Ruby Gem
on:
workflow_dispatch:
inputs:
# trunk-ignore(checkov/CKV_GHA_7)
release_tag:
type: string
description: Tag to create
required: True
workflow_call:
inputs:
release_tag:
type: string
description: Tag to create
required: True
concurrency: ${{ github.workflow }}
permissions:
contents: read
id-token: write
jobs:
ci-data:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.fetch.outputs.result }}
steps:
- uses: oxidize-rb/actions/setup-ruby-and-rust@main
with:
rubygems: latest
ruby-version: "4.0"
bundler-cache: false
cargo-cache: false
cargo-vendor: false
- uses: oxidize-rb/actions/fetch-ci-data@v1
id: fetch
with:
supported-ruby-platforms: |
exclude: [arm-linux]
stable-ruby-versions: |
exclude: [head]
cross-gem:
name: ${{ matrix.platform == 'ruby' && 'Validate ruby platform gem' || format('Build gem for {0}', matrix.platform) }}
runs-on: ubuntu-latest
needs: ci-data
strategy:
matrix:
platform:
- x86_64-linux-gnu
- x86_64-linux-musl
- aarch64-linux-gnu
- aarch64-linux-musl
- arm64-darwin
- x86_64-darwin
- ruby
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "4.0"
bundler-cache: true
working-directory: rspec-trunk-flaky-tests
- name: Update CLI version
uses: ./.github/actions/update_version
if: "!cancelled()"
with:
version: ${{ github.event.inputs.release_tag || inputs.release_tag }}
file: ./cli/Cargo.toml
- name: Update Test Report version
uses: ./.github/actions/update_version
if: "!cancelled()"
with:
version: ${{ github.event.inputs.release_tag || inputs.release_tag }}
file: ./test_report/Cargo.toml
- name: Update Gem version
uses: ./.github/actions/update_version
if: "!cancelled()"
with:
version: ${{ github.event.inputs.release_tag || inputs.release_tag }}
file: rspec-trunk-flaky-tests/rspec_trunk_flaky_tests.gemspec
# this is necessary because the cross-gem action doesn't support reading the Gemfile.lock from the subdirectory
# leading to a mismatch in the rb_sys version
- name: Copy Gemfile.lock to root
if: matrix.platform != 'ruby'
run: cp rspec-trunk-flaky-tests/Gemfile.lock ./Gemfile.lock
shell: bash
- name: Cross-compile native gem
if: matrix.platform != 'ruby'
uses: oxidize-rb/actions/cross-gem@v1
with:
platform: ${{ matrix.platform }}
working-directory: rspec-trunk-flaky-tests
ruby-versions: 3.1,3.2,3.3,3.4,4.0
- name: Validate ruby platform gem
if: matrix.platform == 'ruby'
uses: ./.github/actions/validate_ruby_platform_gem
- uses: actions/upload-artifact@v4
with:
name: cross-gem-${{ matrix.platform }}
path: rspec-trunk-flaky-tests/pkg/*.gem
if-no-files-found: error
retention-days: 1
test-ruby-gem:
name: Test Ruby Gem
runs-on: ${{ matrix.platform.os }}
needs: [ci-data, cross-gem]
strategy:
matrix:
ruby-version: ["3.1", "3.2", "3.3", "3.4", "4.0"]
platform:
- name: x86_64-linux-gnu
os: ubuntu-latest
- name: aarch64-linux-gnu
os: ubuntu-24.04-arm
- name: arm64-darwin
os: macos-latest
- name: x86_64-darwin
os: macos-15-intel
steps:
- uses: actions/checkout@v4
- name: Test ruby gem uploads → analytics-cli-ruby-gem (staging)
uses: ./.github/actions/test_ruby_gem_uploads
with:
ruby-version: ${{ matrix.ruby-version }}
trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
trunk-public-api-address: https://api.trunk-staging.io
trunk-org-slug: trunk-staging-org
test-collection-id: T5yKSn9h
platform: ${{ matrix.platform.name }}
variant: ${{ matrix.platform.name }}
artifact-pattern: cross-gem-${{ matrix.platform.name }}
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
- name: Test ruby gem uploads → analytics-cli-ruby-gem (prod)
uses: ./.github/actions/test_ruby_gem_uploads
with:
ruby-version: ${{ matrix.ruby-version }}
trunk-token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
trunk-public-api-address: https://api.trunk.io
trunk-org-slug: trunk
test-collection-id: BiBP2neA
platform: ${{ matrix.platform.name }}
variant: ${{ matrix.platform.name }}
artifact-pattern: cross-gem-${{ matrix.platform.name }}
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
# Validate the musl gems inside Alpine (ruby/setup-ruby has no Alpine support).
test-musl-gem:
name: Test ${{ matrix.platform.name }} gem on Alpine (ruby ${{ matrix.ruby-version }})
runs-on: ${{ matrix.platform.os }}
needs: cross-gem
strategy:
fail-fast: false
matrix:
ruby-version: ["3.4"]
platform:
- name: x86_64-linux-musl
os: ubuntu-latest
- name: aarch64-linux-musl
os: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Test musl gem uploads → analytics-cli-ruby-gem (staging)
uses: ./.github/actions/test_ruby_gem_uploads
with:
alpine: "true"
ruby-version: ${{ matrix.ruby-version }}
trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
trunk-public-api-address: https://api.trunk-staging.io
trunk-org-slug: trunk-staging-org
test-collection-id: T5yKSn9h
platform: ${{ matrix.platform.name }}
variant: ${{ matrix.platform.name }}
artifact-pattern: cross-gem-${{ matrix.platform.name }}
knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
publish_ruby_gem:
runs-on: ubuntu-latest
needs: [test-ruby-gem, test-musl-gem]
steps:
- uses: actions/checkout@v4
- uses: rubygems/configure-rubygems-credentials@main
with:
role-to-assume: ${{ secrets.RUBY_GEMS_OIDC }}
- uses: actions/download-artifact@v4
with:
pattern: cross-gem-*
path: rspec-trunk-flaky-tests/pkg/
merge-multiple: true
- working-directory: rspec-trunk-flaky-tests
run: |
set -euxo pipefail
find pkg
for i in $(ls pkg/*.gem); do
gem push $i
done