-
Notifications
You must be signed in to change notification settings - Fork 7
153 lines (137 loc) Β· 5.39 KB
/
Copy pathbuild.yml
File metadata and controls
153 lines (137 loc) Β· 5.39 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
name: Build
on:
workflow_dispatch:
inputs:
version:
required: true
type: string
workflow_call:
inputs:
version:
required: true
type: string
permissions:
contents: read
jobs:
build-macos:
runs-on: macos-14
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ruby/setup-ruby@v1
id: setup-ruby
with:
ruby-version: ${{ inputs.version }}
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Build portable Ruby
env:
JDX_RUBY_BASERUBY: ${{ steps.setup-ruby.outputs.ruby-prefix }}/bin/ruby
JDX_RUBY_RUSTUP_HOME: ${{ github.workspace }}/.build/rustup-macos
run: bin/package "${{ inputs.version }}" --target macos --yjit --output rubies
- name: Upload portable Ruby
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ruby-${{ inputs.version }}-macos-yjit-true
path: rubies/
- name: Test portable Ruby
run: |
mkdir -p jdx-ruby
tar --strip-components 1 -C jdx-ruby -xf rubies/*.tar.gz
export PATH="${PWD}/jdx-ruby/bin:${PATH}"
ruby --version --yjit
ruby -r debug -r bigdecimal -r json -r yaml -r reline -e "true"
build-linux:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-22.04
target: x86_64_linux
yjit: true
- runner: ubuntu-22.04
target: x86_64_linux
yjit: false
- runner: ubuntu-22.04-arm
target: arm64_linux
yjit: true
- runner: ubuntu-22.04-arm
target: arm64_linux
yjit: false
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
- name: Resolve target container
id: target
env:
TARGET: ${{ matrix.target }}
run: |
container=$(ruby -ryaml -e 'puts YAML.load_file("recipes/targets.yml").fetch("targets").fetch(ENV.fetch("TARGET")).fetch("container")')
echo "container=$container" >> "$GITHUB_OUTPUT"
- name: Build portable Ruby in manylinux2014
env:
VERSION: ${{ inputs.version }}
TARGET: ${{ matrix.target }}
YJIT: ${{ matrix.yjit }}
CONTAINER: ${{ steps.target.outputs.container }}
BOOTSTRAP_VERSION: "3.4.7"
run: |
set -euxo pipefail
docker pull "$CONTAINER"
docker run --rm \
-e VERSION \
-e TARGET \
-e YJIT \
-e BOOTSTRAP_VERSION \
-v "$PWD:/work" \
-w /work \
"$CONTAINER" \
/bin/bash -lc '
set -euxo pipefail
yum install -y curl tar gzip xz make gcc gcc-c++ perl perl-IPC-Cmd perl-Time-Piece patch file findutils diffutils which git binutils
bootstrap_version="$BOOTSTRAP_VERSION"
bootstrap_root=".build/bootstrap/${TARGET}-${bootstrap_version}"
if [[ ! -x "${bootstrap_root}/bin/ruby" ]]; then
case "$TARGET" in
x86_64_linux) bootstrap_platform="x86_64_linux" ;;
arm64_linux) bootstrap_platform="arm64_linux" ;;
*) echo "unknown target: $TARGET" >&2; exit 1 ;;
esac
bootstrap_url="https://github.com/jdx/ruby/releases/download/${bootstrap_version}/ruby-${bootstrap_version}.${bootstrap_platform}.no_yjit.tar.gz"
rm -rf "$bootstrap_root"
mkdir -p "$bootstrap_root"
curl -fL --retry 3 -o /tmp/bootstrap-ruby.tar.gz "$bootstrap_url"
tar -xzf /tmp/bootstrap-ruby.tar.gz -C "$bootstrap_root" --strip-components 1
fi
export PATH="${PWD}/${bootstrap_root}/bin:${PATH}"
if [[ "$YJIT" == "true" ]]; then
curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none
export PATH="${HOME}/.cargo/bin:${PATH}"
export JDX_RUBY_RUSTUP_HOME="${PWD}/.build/rustup-${TARGET}"
yjit_arg="--yjit"
else
yjit_arg="--no-yjit"
fi
bin/package "$VERSION" --target "$TARGET" "$yjit_arg" --output rubies
chown -R "$(stat -c %u /work):$(stat -c %g /work)" rubies .build .cache || true
'
- name: Upload portable Ruby
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ruby-${{ inputs.version }}-${{ matrix.target }}-yjit-${{ matrix.yjit }}
path: rubies/
- name: Test portable Ruby
run: |
mkdir -p jdx-ruby
tar --strip-components 1 -C jdx-ruby -xf rubies/*.tar.gz
export PATH="${PWD}/jdx-ruby/bin:${PATH}"
if [[ "${{ matrix.yjit }}" == "true" ]]; then
ruby --version --yjit
else
ruby --version
fi
ruby -r debug -r bigdecimal -r json -r yaml -r reline -e "true"