Skip to content

Commit a297440

Browse files
Test against different OpenSSL library versions (#464)
1 parent b36556d commit a297440

File tree

3 files changed

+177
-6
lines changed

3 files changed

+177
-6
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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: Restore cached OpenSSL library
12+
id: cache-openssl-restore
13+
uses: actions/cache/restore@v4
14+
with:
15+
path: ~/openssl
16+
key: openssl-${{ inputs.version }}
17+
18+
- name: Compile OpenSSL library
19+
if: steps.cache-openssl-restore.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+
3.*)
33+
OPENSSL_COMMIT=openssl-
34+
OPENSSL_COMMIT+=$(echo ${{ inputs.version }})
35+
git clone -b $OPENSSL_COMMIT --depth 1 https://github.com/openssl/openssl.git .
36+
echo "Git commit: $(git rev-parse HEAD)"
37+
if [[ ${{ inputs.version }} == 3.5* ]]; then
38+
./Configure --prefix=$HOME/openssl --libdir=lib enable-fips no-tests no-legacy
39+
else
40+
./Configure --prefix=$HOME/openssl --libdir=lib enable-fips no-tests
41+
fi
42+
make -j4 && make install_sw && make install_fips
43+
;;
44+
*)
45+
echo "Don't know how to build OpenSSL ${{ inputs.version }}"
46+
;;
47+
esac
48+
49+
- name: Save OpenSSL library cache
50+
if: steps.cache-openssl-restore.outputs.cache-hit != 'true'
51+
id: cache-openssl-save
52+
uses: actions/cache/save@v4
53+
with:
54+
path: ~/openssl
55+
key: ${{ steps.cache-openssl-restore.outputs.cache-primary-key }}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Install Ruby
2+
3+
inputs:
4+
version:
5+
description: 'The version of Ruby to install'
6+
required: true
7+
openssl-version:
8+
description: 'The version of OpenSSL used'
9+
required: true
10+
11+
runs:
12+
using: 'composite'
13+
steps:
14+
- name: Restore cached Ruby installation
15+
id: cache-ruby-restore
16+
uses: actions/cache/restore@v4
17+
with:
18+
path: ~/rubies/ruby-${{ inputs.version }}
19+
key: ruby-${{ inputs.version }}-with-openssl-${{ inputs.openssl-version }}
20+
21+
- name: Install Ruby
22+
if: steps.cache-ruby-restore.outputs.cache-hit != 'true'
23+
shell: bash
24+
run: |
25+
latest_patch=$(curl -s https://cache.ruby-lang.org/pub/ruby/${{ inputs.version }}/ \
26+
| grep -oP "ruby-${{ inputs.version }}\.\d+\.tar\.xz" \
27+
| grep -oP "\d+(?=\.tar\.xz)" \
28+
| sort -V | tail -n 1)
29+
wget https://cache.ruby-lang.org/pub/ruby/${{ inputs.version }}/ruby-${{ inputs.version }}.${latest_patch}.tar.xz
30+
tar -xJvf ruby-${{ inputs.version }}.${latest_patch}.tar.xz
31+
cd ruby-${{ inputs.version }}.${latest_patch}
32+
./configure --prefix=$HOME/rubies/ruby-${{ inputs.version }} --with-openssl-dir=$HOME/openssl
33+
make
34+
make install
35+
36+
- name: Update PATH
37+
shell: bash
38+
run: |
39+
echo "~/rubies/ruby-${{ inputs.version }}/bin" >> $GITHUB_PATH
40+
41+
- name: Install Bundler
42+
shell: bash
43+
run: |
44+
case ${{ inputs.version }} in
45+
2.7* | 3.*)
46+
echo "Skipping Bundler installation for Ruby ${{ inputs.version }}"
47+
;;
48+
2.5* | 2.6*)
49+
gem install bundler -v '~> 2.3.0'
50+
;;
51+
*)
52+
echo "Don't know how to install Bundler for Ruby ${{ inputs.version }}"
53+
;;
54+
esac
55+
56+
- name: Save Ruby installation cache
57+
if: steps.cache-ruby-restore.outputs.cache-hit != 'true'
58+
id: cache-ruby-save
59+
uses: actions/cache/save@v4
60+
with:
61+
path: ~/rubies/ruby-${{ inputs.version }}
62+
key: ${{ steps.cache-ruby-restore.outputs.cache-primary-key }}
63+
64+
- name: Cache Bundler Install
65+
id: cache-bundler-restore
66+
uses: actions/cache/restore@v4
67+
env:
68+
GEMFILE: ${{ env.BUNDLE_GEMFILE || 'Gemfile' }}
69+
with:
70+
path: ~/bundler/cache
71+
key: bundler-ruby-${{ inputs.version }}-${{ inputs.openssl-version }}-${{ hashFiles(env.Gemfile, 'webauthn.gemspec') }}
72+
73+
- name: Install dependencies
74+
shell: bash
75+
run: |
76+
bundle config set --local path ~/bundler/cache
77+
bundle install
78+
79+
- name: Save Bundler Install cache
80+
id: cache-bundler-save
81+
uses: actions/cache/save@v4
82+
with:
83+
path: ~/bundler/cache
84+
key: ${{ steps.cache-bundler-restore.outputs.cache-primary-key }}

.github/workflows/build.yml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515

1616
jobs:
1717
test:
18+
name: 'Test Ruby ${{ matrix.ruby }} with OpenSSL ${{ matrix.openssl }}'
1819
runs-on: ubuntu-24.04
1920
strategy:
2021
fail-fast: false
@@ -24,17 +25,48 @@ jobs:
2425
- '3.3'
2526
- '3.2'
2627
- '3.1'
27-
- '3.0'
28-
- '2.7'
29-
- '2.6'
30-
- '2.5'
31-
- truffleruby
28+
openssl:
29+
- '3.5.3'
30+
- '3.4.2'
31+
- '3.3.4'
32+
- '3.2.5'
33+
- '3.1.8'
34+
- '3.0.17'
35+
- '1.1.1w'
36+
include:
37+
- ruby: truffleruby
38+
- ruby: '3.0'
39+
openssl: '1.1.1w'
40+
- ruby: '2.7'
41+
openssl: '1.1.1w'
42+
- ruby: '2.6'
43+
openssl: '1.1.1w'
44+
- ruby: '2.5'
45+
openssl: '1.1.1w'
46+
3247
steps:
3348
- uses: actions/checkout@v5
34-
- uses: ruby/setup-ruby@v1
49+
50+
- name: Install OpenSSL
51+
if: matrix.ruby != 'truffleruby'
52+
uses: ./.github/actions/install-openssl
53+
with:
54+
version: ${{ matrix.openssl }}
55+
56+
- name: Manually set up Ruby
57+
if: matrix.ruby != 'truffleruby'
58+
uses: ./.github/actions/install-ruby
59+
with:
60+
version: ${{ matrix.ruby }}
61+
openssl-version: ${{ matrix.openssl }}
62+
63+
- name: Set up Ruby
64+
if: matrix.ruby == 'truffleruby'
65+
uses: ruby/setup-ruby@v1
3566
with:
3667
ruby-version: ${{ matrix.ruby }}
3768
bundler-cache: true
69+
3870
- run: bundle exec rspec
3971
env:
4072
RUBYOPT: ${{ startsWith(matrix.ruby, '3.4') && '--enable=frozen-string-literal' || '' }}

0 commit comments

Comments
 (0)