Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github Action cache example into README.md #447

Merged
merged 1 commit into from Nov 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 38 additions & 1 deletion README.md
Expand Up @@ -81,7 +81,7 @@ To use Dialyzer in CI, you must be aware of several things:
2) The PLT should be cached using the CI caching system
3) The PLT will need to be rebuilt whenever adding a new Erlang or Elixir version to build matrix

Using Travis, this would look like:
### Travis

`.travis.yml`
```markdown
Expand All @@ -101,6 +101,43 @@ cache:
- priv/plts
```

### Github Actions

`dialyzer.yml`
```yaml
...
steps:
- uses: actions/checkout@v2
- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
elixir-version: "1.12.3" # Define the elixir version
otp-version: "24.1" # Define the OTP version

# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
# Cache key based on Elixir & Erlang version (also usefull when running in matrix)
- name: Restore PLT cache
uses: actions/cache@v2
id: plt_cache
with:
key: |
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
restore-keys: |
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
path: |
priv/plts

# Create PLTs if no cache was found
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt

- name: Run dialyzer
run: mix dialyzer

```

`mix.exs`
```elixir
def project do
Expand Down