-
Notifications
You must be signed in to change notification settings - Fork 56
134 lines (118 loc) · 4.81 KB
/
build-ruby-release.reusable.yaml
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
name: BAML Release - Build Ruby
on:
workflow_call: {}
push:
branches: [aaron-fix]
permissions:
contents: read
id-token: write
concurrency:
# suffix is important to prevent a concurrency deadlock with the calling workflow
group: ${{ github.workflow }}-${{ github.ref }}-build-ruby
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
_:
- platform: x86_64-linux
# This is necessary because rb-sys-dock depends on manylinux2014,
# which is based on CentOS 7 which is EOL as of July 2024 Once
# rake-compiler-dock switches to manylinux_2_28 and rb-sys-dock
# picks that up, we can pick their updates up and then drop this.
# See https://github.com/oxidize-rb/rb-sys/issues/402 and
# https://github.com/rake-compiler/rake-compiler-dock/issues/122
# for more details.
rb-sys-dock-setup: ./x86-64_linux-setup.sh
- platform: x86_64-linux-musl
- platform: aarch64-linux
- platform: aarch64-linux-musl
- platform: arm-linux
- platform: arm64-darwin
# - platform: x64-mingw32
# - platform: x86-mingw-ucrt
runs-on: ubuntu-latest
name: ${{ matrix._.platform }}
defaults:
run:
working-directory: engine/language_client_ruby
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/setup-ruby-and-rust@main
with:
rubygems: latest
ruby-version: "3.3"
bundler-cache: false
cargo-cache: false
cargo-vendor: false
#################################################################################################################
#
# BEGIN: these steps are copied from https://github.com/oxidize-rb/actions/blob/main/cross-gem/action.yml
#
# We can't use oxidize-rb/actions/cross-gem@main directly, unfortunately, because our Ruby FFI lib is a member
# of the top-level workspace, and we need to do stuff to make rb-sys-dock play nice with it
#
#################################################################################################################
- name: Configure environment
shell: bash
id: configure
run: |
: Configure environment
echo "RB_SYS_DOCK_UID=$(id -u)" >> $GITHUB_ENV
echo "RB_SYS_DOCK_GID=$(id -g)" >> $GITHUB_ENV
rb_sys_version="$((grep rb_sys Gemfile.lock | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') || (gem info rb_sys --remote | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') || echo "latest")"
rb_sys_dock_cache_dir="$HOME/.cache/rb-sys-$rb_sys_version"
mkdir -p "$rb_sys_dock_cache_dir"
echo "RB_SYS_DOCK_CACHE_DIR=$rb_sys_dock_cache_dir" >> $GITHUB_ENV
echo "rb_sys_version=$rb_sys_version" >> $GITHUB_OUTPUT
cat >>$GITHUB_ENV <<EOF
RUSTFLAGS=--cfg tracing_unstable
EOF
- name: Setup rb-sys
shell: bash
run: |
version="${{ steps.configure.outputs.rb_sys_version }}"
echo "Installing rb_sys@$version"
if [ "$version" = "latest" ]; then
gem install rb_sys
else
gem install rb_sys -v $version
fi
- name: Build gem
shell: bash
working-directory: engine
run: |
: Compile gem
echo "Docker Working Directory: $(pwd)"
set -x
# Unfortunately we can't actually parallelize the Ruby versions
# because they get bundled into the same gem
rb-sys-dock \
--platform ${{ matrix._.platform }} \
--mount-toolchains \
--directory language_client_ruby \
--ruby-versions 3.3,3.2,3.1 \
--build \
-- ${{ matrix._.rb-sys-dock-setup }}
- name: Show built gem
shell: bash
run: find pkg -name '*.gem'
#################################################################################################################
#
# END: these steps are copied from https://github.com/oxidize-rb/actions/blob/main/cross-gem/action.yml
#
# We can't use oxidize-rb/actions/cross-gem@main directly, unfortunately, because our Ruby FFI lib is a member
# of the top-level workspace, and we need to do stuff to make rb-sys-dock play nice with it
#
#################################################################################################################
- name: Upload Ruby artifact
uses: actions/upload-artifact@v4
with:
name: gem-${{ matrix._.platform }}
path: engine/language_client_ruby/pkg/*.gem
if-no-files-found: error
# - run: |
# for i in $(ls pkg/*.gem); do
# gem push $i
# done