-
Notifications
You must be signed in to change notification settings - Fork 7
159 lines (144 loc) · 4.66 KB
/
release_ruby_gem.yml
File metadata and controls
159 lines (144 loc) · 4.66 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
---
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
- aarch64-linux
- 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.0,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.0", "3.1", "3.2", "3.3", "3.4", "4.0"]
platform:
- name: x86_64-linux
os: ubuntu-latest
- name: aarch64-linux
os: ubuntu-24.04-arm
- name: arm64-darwin
os: macos-latest
- name: x86_64-darwin
os: macos-15-intel
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test_ruby_gem_uploads
with:
ruby-version: ${{ matrix.ruby-version }}
trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
platform: ${{ 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
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