Skip to content

Commit a01cac1

Browse files
ci: cache even when job fails
1 parent 8479763 commit a01cac1

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ inputs:
66
runs:
77
using: 'composite'
88
steps:
9-
- name: Cache OpenSSL library
10-
id: cache-openssl
11-
uses: actions/cache@v4
9+
- name: Restore cached OpenSSL library
10+
id: cache-openssl-restore
11+
uses: actions/cache/restore@v4
1212
with:
1313
path: ~/openssl
1414
key: openssl-${{ inputs.version }}
1515

1616
- name: Compile OpenSSL library
17-
if: steps.cache-openssl.outputs.cache-hit != 'true'
17+
if: steps.cache-openssl-restore.outputs.cache-hit != 'true'
1818
shell: bash
1919
run: |
2020
mkdir -p tmp/build-openssl && cd tmp/build-openssl
@@ -43,3 +43,11 @@ runs:
4343
echo "Don't know how to build OpenSSL ${{ inputs.version }}"
4444
;;
4545
esac
46+
47+
- name: Save OpenSSL library cache
48+
if: steps.cache-openssl-restore.outputs.cache-hit != 'true'
49+
id: cache-openssl-save
50+
uses: actions/cache/save@v4
51+
with:
52+
path: ~/openssl
53+
key: ${{ steps.cache-openssl-restore.outputs.cache-primary-key }}

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

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

1919
- name: Install Ruby
20-
if: steps.ruby-cache.outputs.cache-hit != 'true'
20+
if: steps.cache-ruby-restore.outputs.cache-hit != 'true'
2121
shell: bash
2222
run: |
2323
latest_patch=$(curl -s https://cache.ruby-lang.org/pub/ruby/${{ inputs.version }}/ \
@@ -48,17 +48,32 @@ runs:
4848
echo "Don't know how to install Bundler for Ruby ${{ inputs.version }}"
4949
;;
5050
esac
51+
- name: Save Ruby installation cache
52+
id: cache-ruby-save
53+
uses: actions/cache/save@v4
54+
with:
55+
path: ~/rubies/ruby-${{ inputs.version }}
56+
key: ${{ steps.cache-ruby-restore.outputs.cache-primary-key }}
5157
- name: Cache Bundler Install
52-
id: bundler-cache
53-
uses: actions/cache@v4
58+
id: cache-bundler-restore
59+
uses: actions/cache/restore@v4
5460
env:
5561
GEMFILE: ${{ env.BUNDLE_GEMFILE || 'Gemfile' }}
5662
with:
5763
path: ./vendor/bundle
5864
key: bundler-ruby-${{ inputs.version }}-${{ inputs.openssl-version }}-${{ hashFiles(env.Gemfile, 'webauthn.gemspec') }}
5965

6066
- name: Install dependencies
67+
if: steps.cache-bundler-restore.outputs.cache-hit != 'true'
6168
shell: bash
6269
run: |
6370
bundle config set --local path ../vendor/bundle
6471
bundle install
72+
73+
- name: Save Bundler Install cache
74+
if: steps.cache-bundler-restore.outputs.cache-hit != 'true'
75+
id: cache-bundler-save
76+
uses: actions/cache/save@v4
77+
with:
78+
path: ./vendor/bundle
79+
key: ${{ steps.cache-bundler-restore.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)