@@ -77,31 +77,18 @@ runs:
7777 elixir-version : ${{ inputs.elixir-version }}
7878 otp-version : ${{ inputs.otp-version }}
7979
80- - name : Get deps cache
81- uses : actions/cache@v4
82- with :
83- path : deps/
84- key : deps-${{ inputs.cache-key }}-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}
85- restore-keys : |
86- deps-${{ inputs.cache-key }}-${{ runner.os }}-
80+ # Restore cache before building
81+ - name : Restore local cache
82+ shell : bash
83+ run : ${{ github.action_path }}/localcache.sh restore deps-${{ inputs.cache-key }}-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} deps/
8784
8885 - name : Get build cache
89- uses : actions/cache@v4
90- id : build-cache
91- with :
92- path : _build/${{env.MIX_ENV}}/
93- key : build-${{ inputs.cache-key }}-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ env.MIX_ENV }}-${{ hashFiles('**/mix.lock') }}
94- restore-keys : |
95- build-${{ inputs.cache-key }}-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ env.MIX_ENV }}-
86+ shell : bash
87+ run : ${{ github.action_path }}/localcache.sh restore build-${{ inputs.cache-key }}-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ env.MIX_ENV }}-${{ hashFiles('**/mix.lock') }} _build/${{env.MIX_ENV}}/
9688
9789 - name : Get Hex cache
98- uses : actions/cache@v4
99- id : hex-cache
100- with :
101- path : ~/.hex
102- key : build-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
103- restore-keys : |
104- build-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-
90+ shell : bash
91+ run : ${{ github.action_path }}/localcache.sh restore hex-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ hashFiles('**/mix.lock') }} ~/.hex
10592
10693 # In my experience, I have issues with incremental builds maybe 1 in 100
10794 # times that are fixed by doing a full recompile.
@@ -145,6 +132,19 @@ runs:
145132 shell : sh
146133 if : inputs.build-app == 'true'
147134
135+ # Save cache after the build is done
136+ - name : Save local deps cache
137+ shell : bash
138+ run : ${{ github.action_path }}/localcache.sh save deps-${{ inputs.cache-key }}-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} deps/
139+
140+ - name : Save local build cache
141+ shell : bash
142+ run : ${{ github.action_path }}/localcache.sh save build-${{ inputs.cache-key }}-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ env.MIX_ENV }}-${{ hashFiles('**/mix.lock') }} _build/${{env.MIX_ENV}}/
143+
144+ - name : Save local Hex cache
145+ shell : bash
146+ run : ${{ github.action_path }}/localcache.sh save hex-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ hashFiles('**/mix.lock') }} ~/.hex
147+
148148 # Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
149149 # Cache key based on Elixir & Erlang version (also useful when running in matrix)
150150 - name : Restore PLT cache
0 commit comments