Skip to content

Commit c759c5c

Browse files
ci: manually install OpenSSL 1.1.1w
1 parent c9f656f commit c759c5c

File tree

3 files changed

+118
-1
lines changed

3 files changed

+118
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Install OpenSSL
2+
3+
inputs:
4+
version:
5+
description: 'The version of OpenSSL to install'
6+
required: true
7+
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Cache OpenSSL library
12+
id: cache-openssl
13+
uses: actions/cache@v4
14+
with:
15+
path: ~/openssl
16+
key: openssl-${{ inputs.version }}
17+
18+
- name: Compile OpenSSL library
19+
if: steps.cache-openssl.outputs.cache-hit != 'true'
20+
shell: bash
21+
run: |
22+
mkdir -p tmp/build-openssl && cd tmp/build-openssl
23+
case ${{ inputs.version }} in
24+
1.1.*)
25+
OPENSSL_COMMIT=OpenSSL_
26+
OPENSSL_COMMIT+=$(echo ${{ inputs.version }} | sed -e 's/\./_/g')
27+
git clone -b $OPENSSL_COMMIT --depth 1 https://github.com/openssl/openssl.git .
28+
echo "Git commit: $(git rev-parse HEAD)"
29+
./Configure --prefix=$HOME/openssl --libdir=lib linux-x86_64
30+
make depend && make -j4 && make install_sw
31+
;;
32+
*)
33+
echo "Don't know how to build OpenSSL ${{ inputs.version }}"
34+
;;
35+
esac
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Install Ruby
2+
3+
inputs:
4+
version:
5+
description: 'The version of Ruby to install'
6+
required: true
7+
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Cache Ruby
12+
id: ruby-cache
13+
uses: actions/cache@v4
14+
with:
15+
path: ~/rubies/ruby-${{ inputs.version }}
16+
key: ruby-${{ inputs.version }}-openssl-1.1.1w
17+
18+
- name: Install Ruby
19+
if: steps.ruby-cache.outputs.cache-hit != 'true'
20+
shell: bash
21+
run: |
22+
latest_patch=$(curl -s https://cache.ruby-lang.org/pub/ruby/${{ inputs.version }}/ \
23+
| grep -oP "ruby-${{ inputs.version }}\.\d+\.tar\.xz" \
24+
| grep -oP "\d+(?=\.tar\.xz)" \
25+
| sort -V | tail -n 1)
26+
wget https://cache.ruby-lang.org/pub/ruby/${{ inputs.version }}/ruby-${{ inputs.version }}.${latest_patch}.tar.xz
27+
tar -xJvf ruby-${{ inputs.version }}.${latest_patch}.tar.xz
28+
cd ruby-${{ inputs.version }}.${latest_patch}
29+
./configure --prefix=$HOME/rubies/ruby-${{ inputs.version }} --with-openssl-dir=$HOME/openssl
30+
make
31+
make install
32+
33+
- name: Update PATH
34+
shell: bash
35+
run: |
36+
echo "~/rubies/ruby-${{ inputs.version }}/bin" >> $GITHUB_PATH
37+
38+
- name: Install Bundler
39+
shell: bash
40+
run: |
41+
case ${{ inputs.version }} in
42+
2.7* | 3.*)
43+
echo "Skipping Bundler installation for Ruby ${{ inputs.version }}"
44+
;;
45+
2.5* | 2.6*)
46+
gem install bundler -v '~> 2.3.0'
47+
;;
48+
*)
49+
echo "Don't know how to install Bundler for Ruby ${{ inputs.version }}"
50+
;;
51+
esac
52+
53+
- name: Cache Bundler Install
54+
id: bundler-cache
55+
uses: actions/cache@v4
56+
env:
57+
GEMFILE: ${{ env.BUNDLE_GEMFILE || 'Gemfile' }}
58+
with:
59+
path: ~/bundler/cache
60+
key: bundler-ruby-${{ inputs.version }}-${{ hashFiles(env.Gemfile, 'webauthn.gemspec') }}
61+
62+
- name: Install dependencies
63+
shell: bash
64+
run: |
65+
bundle config set --local path ~/bundler/cache
66+
bundle install

.github/workflows/build.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,26 @@ jobs:
3131
- truffleruby
3232
steps:
3333
- uses: actions/checkout@v4
34-
- uses: ruby/setup-ruby@v1
34+
35+
- name: Install OpenSSL
36+
if: matrix.ruby != 'truffleruby'
37+
uses: ./.github/actions/install-openssl
38+
with:
39+
version: "1.1.1w"
40+
41+
- name: Manually set up Ruby
42+
if: matrix.ruby != 'truffleruby'
43+
uses: ./.github/actions/install-ruby
44+
with:
45+
version: ${{ matrix.ruby }}
46+
47+
- name: Set up Ruby
48+
if: matrix.ruby == 'truffleruby'
49+
uses: ruby/setup-ruby@v1
3550
with:
3651
ruby-version: ${{ matrix.ruby }}
3752
bundler-cache: true
53+
3854
- run: bundle exec rspec
3955
env:
4056
RUBYOPT: ${{ startsWith(matrix.ruby, '3.4') && '--enable=frozen-string-literal' || '' }}

0 commit comments

Comments
 (0)