File tree Expand file tree Collapse file tree 2 files changed +49
-23
lines changed Expand file tree Collapse file tree 2 files changed +49
-23
lines changed Original file line number Diff line number Diff line change
1
+ name : ' Dialyzer Cache'
2
+ description : ' Handles caching for Dialyzer PLTs'
3
+ inputs :
4
+ otp-version :
5
+ description : ' OTP version'
6
+ required : true
7
+ elixir-version :
8
+ description : ' Elixir version'
9
+ required : true
10
+ mix-lock-hash :
11
+ description : ' Hash of the mix.lock file, defaults to hashing `**/mix.lock`'
12
+ required : false
13
+ default : ' '
14
+ build-plt-command :
15
+ description : ' The command to run to build PLT(s), defaults to `mix dialyzer --plt`'
16
+ default : mix dialyzer --plt
17
+ runs :
18
+ using : ' composite'
19
+ steps :
20
+ - name : Calculate mix.lock hash
21
+ if : inputs.mix-lock-hash == ''
22
+ id : mix-lock-hash
23
+ run : echo "hash=${{ hashFiles('**/mix.lock') }}" >> $GITHUB_OUTPUT
24
+ shell : bash
25
+ - name : Restore PLT cache
26
+ id : restore-cache
27
+ uses : actions/cache/restore@v3
28
+ with :
29
+ key : |
30
+ plt-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ steps.mix-lock-hash.outputs.hash || inputs.mix-lock-hash }}
31
+ restore-keys : |
32
+ plt-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-
33
+ path : |
34
+ priv/plts
35
+ - name : Create PLTs
36
+ if : steps.restore-cache.outputs.cache-hit != 'true'
37
+ run : ${{ inputs.build-plt-command }}
38
+ shell : bash
39
+ - name : Save PLT cache
40
+ if : steps.restore-cache.outputs.cache-hit != 'true'
41
+ uses : actions/cache/save@v3
42
+ with :
43
+ key : |
44
+ plt-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ steps.mix-lock-hash.outputs.hash || inputs.mix-lock-hash }}
45
+ path : |
46
+ priv/plts
Original file line number Diff line number Diff line change @@ -46,30 +46,10 @@ jobs:
46
46
- uses : actions/checkout@v3
47
47
- uses : pkgxdev/dev@v0
48
48
- run : mix deps.get
49
- - name : Restore PLT cache
50
- id : plt_cache
51
- uses : actions/cache/restore@v3
49
+ - uses : ./.github/actions/dialyzer-cache
52
50
with :
53
- key : |
54
- plt-${{ runner.os }}-${{ needs.version.outputs.otp-version }}-${{ needs.version.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
55
- restore-keys : |
56
- plt-${{ runner.os }}-${{ needs.version.outputs.otp-version }}-${{ needs.version.outputs.elixir-version }}-
57
- path : |
58
- priv/plts
59
- - name : Create PLTs
60
- if : steps.plt_cache.outputs.cache-hit != 'true'
61
- run : mix dialyzer --plt
62
- # By default, the GitHub Cache action will only save the cache if all steps in the job succeed,
63
- # so we separate the cache restore and save steps in case running dialyzer fails.
64
- - name : Save PLT cache
65
- id : plt_cache_save
66
- uses : actions/cache/save@v3
67
- if : steps.plt_cache.outputs.cache-hit != 'true'
68
- with :
69
- key : |
70
- plt-${{ runner.os }}-${{ needs.version.outputs.otp-version }}-${{ needs.version.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
71
- path : |
72
- priv/plts
51
+ otp-version : ${{ needs.version.outputs.otp-version }}
52
+ elixir-version : ${{ needs.version.outputs.elixir-version }}
73
53
- run : bin/audit
74
54
75
55
build :
You can’t perform that action at this time.
0 commit comments