-
Notifications
You must be signed in to change notification settings - Fork 11
135 lines (120 loc) · 3.95 KB
/
build-gems.yml
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
name: Build Gems
on:
pull_request:
push:
branches:
- main
- "releases/*"
jobs:
build-platform-gems:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# TODO(cretz): Enable x64-mingw-ucrt if we can figure out Windows issue, see
# https://github.com/temporalio/sdk-ruby/issues/172
rubyPlatform: ["aarch64-linux", "aarch64-linux-musl", "x86_64-linux", "x86_64-linux-musl", "arm64-darwin", "x86_64-darwin"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Ruby and Rust
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "3.4"
bundler-cache: true
cargo-cache: true
cargo-vendor: true
working-directory: ./temporalio
cache-version: v1-${{ matrix.rubyPlatform }}
- name: Cross compile gem
uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ matrix.rubyPlatform }}
ruby-versions: "3.2,3.3,3.4"
working-directory: ./temporalio
- name: Upload gem
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.rubyPlatform }}-gem
path: ${{ steps.cross-gem.outputs.gem-path }}
build-source-gem:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Ruby and Rust
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "3.4"
bundler-cache: true
cargo-cache: true
cache-version: v1-source
- name: Install bundle
working-directory: ./temporalio
run: bundle install
- name: Build
working-directory: ./temporalio
run: bundle exec rake build
- name: Upload gem
uses: actions/upload-artifact@v4
with:
name: source-gem
path: temporalio/pkg/*.gem
smoke-test-gems:
needs:
- build-platform-gems
strategy:
fail-fast: false
matrix:
# TODO(cretz): Enable Linux ARM. See ci.yaml comment for why we can't right now.
#
# TODO(cretz): Enable windows-latest if we can figure out Windows issue, see
# https://github.com/temporalio/sdk-ruby/issues/172
os: [ubuntu-latest, macos-intel, macos-latest]
rubyVersion: ["3.2", "3.3", "3.4"]
# Container defaults to empty/none, but additional container for Alpine
# added later
container: [""]
include:
- os: ubuntu-latest
rubyPlatform: x86_64-linux
- os: macos-intel
runsOn: macos-13
rubyPlatform: x86_64-darwin
- os: macos-latest
rubyPlatform: arm64-darwin
- os: ubuntu-latest
rubyVersion: "3.3"
container: alpine/git:latest
rubyPlatform: x86_64-linux-musl
runs-on: ${{ matrix.runsOn || matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download gem
uses: actions/download-artifact@v4
with:
name: ${{ matrix.rubyPlatform }}-gem
path: local-gem
# This only works on official runners
- name: Setup Ruby
if: ${{ matrix.container == '' }}
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "${{ matrix.rubyVersion }}"
bundler-cache: true
cargo-cache: false
# Works for Alpine
- name: Setup Ruby (Alpine)
if: ${{ matrix.container == 'alpine/git:latest' }}
run: apk add --no-cache ruby ruby-dev ruby-bundler
- name: Run smoke test
run: ruby ./temporalio/smoke_test/smoke_test_gem.rb 'local-gem/*-${{ matrix.rubyPlatform }}.gem'