Skip to content

Commit 7410509

Browse files
authored
Merge pull request #447 from Klohto/master
Add Github Action cache example into README.md
2 parents 02f0e15 + 97270a6 commit 7410509

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

README.md

+38-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ To use Dialyzer in CI, you must be aware of several things:
8181
2) The PLT should be cached using the CI caching system
8282
3) The PLT will need to be rebuilt whenever adding a new Erlang or Elixir version to build matrix
8383

84-
Using Travis, this would look like:
84+
### Travis
8585

8686
`.travis.yml`
8787
```markdown
@@ -101,6 +101,43 @@ cache:
101101
- priv/plts
102102
```
103103

104+
### Github Actions
105+
106+
`dialyzer.yml`
107+
```yaml
108+
...
109+
steps:
110+
- uses: actions/checkout@v2
111+
- name: Set up Elixir
112+
id: beam
113+
uses: erlef/setup-beam@v1
114+
with:
115+
elixir-version: "1.12.3" # Define the elixir version
116+
otp-version: "24.1" # Define the OTP version
117+
118+
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
119+
# Cache key based on Elixir & Erlang version (also usefull when running in matrix)
120+
- name: Restore PLT cache
121+
uses: actions/cache@v2
122+
id: plt_cache
123+
with:
124+
key: |
125+
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
126+
restore-keys: |
127+
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
128+
path: |
129+
priv/plts
130+
131+
# Create PLTs if no cache was found
132+
- name: Create PLTs
133+
if: steps.plt_cache.outputs.cache-hit != 'true'
134+
run: mix dialyzer --plt
135+
136+
- name: Run dialyzer
137+
run: mix dialyzer
138+
139+
```
140+
104141
`mix.exs`
105142
```elixir
106143
def project do

0 commit comments

Comments
 (0)