Skip to content

Commit 23c53fe

Browse files
ci: cache even when job fails
1 parent 68d6af9 commit 23c53fe

File tree

2 files changed

+37
-12
lines changed

2 files changed

+37
-12
lines changed

.github/actions/install-openssl/action.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ inputs:
88
runs:
99
using: 'composite'
1010
steps:
11-
- name: Cache OpenSSL library
12-
id: cache-openssl
13-
uses: actions/cache@v4
11+
- name: Restore cached OpenSSL library
12+
id: cache-openssl-restore
13+
uses: actions/cache/restore@v4
1414
with:
1515
path: ~/openssl
1616
key: openssl-${{ inputs.version }}
1717

1818
- name: Compile OpenSSL library
19-
if: steps.cache-openssl.outputs.cache-hit != 'true'
19+
if: steps.cache-openssl-restore.outputs.cache-hit != 'true'
2020
shell: bash
2121
run: |
2222
mkdir -p tmp/build-openssl && cd tmp/build-openssl
@@ -33,3 +33,11 @@ runs:
3333
echo "Don't know how to build OpenSSL ${{ inputs.version }}"
3434
;;
3535
esac
36+
37+
- name: Save OpenSSL library cache
38+
if: steps.cache-openssl-restore.outputs.cache-hit != 'true'
39+
id: cache-openssl-save
40+
uses: actions/cache/save@v4
41+
with:
42+
path: ~/openssl
43+
key: ${{ steps.cache-openssl-restore.outputs.cache-primary-key }}

.github/actions/install-ruby/action.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ inputs:
88
runs:
99
using: 'composite'
1010
steps:
11-
- name: Cache Ruby
12-
id: ruby-cache
13-
uses: actions/cache@v4
11+
- name: Restore cached Ruby installation
12+
id: cache-ruby-restore
13+
uses: actions/cache/restore@v4
1414
with:
1515
path: ~/rubies/ruby-${{ inputs.version }}
1616
key: ruby-${{ inputs.version }}-openssl-1.1.1w
1717

1818
- name: Install Ruby
19-
if: steps.ruby-cache.outputs.cache-hit != 'true'
19+
if: steps.cache-ruby-restore.outputs.cache-hit != 'true'
2020
shell: bash
2121
run: |
2222
latest_patch=$(curl -s https://cache.ruby-lang.org/pub/ruby/${{ inputs.version }}/ \
@@ -50,17 +50,34 @@ runs:
5050
;;
5151
esac
5252
53+
- name: Save Ruby installation cache
54+
if: steps.cache-ruby-restore.outputs.cache-hit != 'true'
55+
id: cache-ruby-save
56+
uses: actions/cache/save@v4
57+
with:
58+
path: ~/rubies/ruby-${{ inputs.version }}
59+
key: ${{ steps.cache-ruby-restore.outputs.cache-primary-key }}
60+
5361
- name: Cache Bundler Install
54-
id: bundler-cache
55-
uses: actions/cache@v4
62+
id: cache-bundler-restore
63+
uses: actions/cache/restore@v4
5664
env:
5765
GEMFILE: ${{ env.BUNDLE_GEMFILE || 'Gemfile' }}
5866
with:
59-
path: ./vendor/bundle
60-
key: bundler-ruby-${{ inputs.version }}-${{ hashFiles(env.Gemfile, 'webauthn.gemspec') }}
67+
path: ../vendor/bundle
68+
key: bundler-ruby-${{ inputs.version }}-openssl-1.1.1w-${{ hashFiles(env.Gemfile, 'webauthn.gemspec') }}
6169

6270
- name: Install dependencies
71+
if: steps.cache-bundler-restore.outputs.cache-hit != 'true'
6372
shell: bash
6473
run: |
6574
bundle config set --local path ../vendor/bundle
6675
bundle install
76+
77+
- name: Save Bundler Install cache
78+
if: steps.cache-bundler-restore.outputs.cache-hit != 'true'
79+
id: cache-bundler-save
80+
uses: actions/cache/save@v4
81+
with:
82+
path: ../vendor/bundle
83+
key: ${{ steps.cache-bundler-restore.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)