Skip to content

Commit

Permalink
fix: add caching for dialyzer and upgrade all cache actions (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaAK authored Jul 7, 2023
1 parent 3ee033a commit 00442dc
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 74 deletions.
3 changes: 0 additions & 3 deletions .dialyzer-ignore.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[
~r|lib/prometheus_telemetry/metrics/graphql/query_name.ex:.*:.*(absinthe_parser\.parse\|Absinthe\.Lexer\.tokenize)|,

~r|lib/prometheus_telemetry/metrics/graphql/request.ex:.*:.*(Absinthe\.Blueprint\.current_operation)|,
~r|test/support/mock_supervisor.ex:.*:.*setup\/0|
]
27 changes: 13 additions & 14 deletions .github/workflows/credo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@ jobs:
Credo:
runs-on: ubuntu-latest

container:
image: mikaak/elixir:1.13-alpine
env:
MIX_ENV: test
env:
MIX_ENV: test

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install Rebar & Hex
run: mix local.hex --force && mix local.rebar --force

- name: Install Tar
run: apk add --no-cache tar
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.15.2' # Define the elixir version [required]
otp-version: '26.0' # Define the OTP version [required]

- name: Cache Deps & Build
uses: actions/cache@v2
with:
key: ${{github.ref}}-deps-build-cache
key: ${{ runner.os }}-mix-credo-${{ hashFiles('**/mix.lock') }}
path: |
./deps
./_build
!._build/dev/lib/error_message/
deps
_build
restore-keys: |
${{ runner.os }}-mix-credo-
- name: Install Dependencies
run: mix deps.get
Expand Down
25 changes: 11 additions & 14 deletions .github/workflows/dialyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,26 @@ jobs:
Dialyzer:
runs-on: ubuntu-latest

container:
image: mikaak/elixir:1.13-alpine
env:
MIX_ENV: test
env:
MIX_ENV: test

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install Rebar & Hex
run: mix local.hex --force && mix local.rebar --force

- name: Install Tar
run: apk add --no-cache tar
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.15.2' # Define the elixir version [required]
otp-version: '26.0' # Define the OTP version [required]

- name: Cache Deps & Build
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: ${{ runner.os }}-mix-dialyzer-${{ hashFiles('**/mix.lock') }}
path: |
deps
_build
dialyzer
!._build/dev/lib/error_message/
.dialyzer
restore-keys: |
${{ runner.os }}-mix-dialyzer-
Expand All @@ -39,6 +36,6 @@ jobs:
run: mix compile

- name: Run Dialyzer
run: mix dialyzer
run: mkdir .dialyzer && mix dialyzer


29 changes: 14 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@ jobs:
Test:
runs-on: ubuntu-latest

container:
image: mikaak/elixir:1.13-alpine
env:
MIX_ENV: test
env:
MIX_ENV: test

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install Rebar & Hex
run: mix local.hex --force && mix local.rebar --force

- name: Install Tar
run: apk add --no-cache tar
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.15.2' # Define the elixir version [required]
otp-version: '26.0' # Define the OTP version [required]

- name: Cache Deps & Build
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: ${{github.ref}}-deps-build-cache
key: ${{ runner.os }}-mix-test-${{ hashFiles('**/mix.lock') }}
path: |
./deps
./_build
!._build/dev/lib/error_message/
deps
_build
restore-keys: |
${{ runner.os }}-mix-test-
- name: Install Dependencies
run: mix deps.get
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ erl_crash.dump
*.beam
/config/*.secret.exs
.elixir_ls/
.dialyzer/

### Elixir Patch ###

Expand Down
5 changes: 4 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ defmodule PrometheusTelemetry.MixProject do
],

dialyzer: [
plt_add_apps: [:ex_unit, :mix],
plt_add_apps: [:ex_unit, :mix, :credo],
list_unused_filters: true,
plt_local_path: ".dialyzer",
plt_core_path: ".dialyzer",
ignore_warnings: ".dialyzer-ignore.exs",
flags: [:unmatched_returns, :no_improper_lists]
]
Expand All @@ -48,6 +50,7 @@ defmodule PrometheusTelemetry.MixProject do
{:ecto, ">= 0.0.0", optional: true},
{:oban, ">= 0.0.0", optional: true},
{:phoenix, ">= 0.0.0", optional: true},
{:hackney, ">= 0.0.0", optional: true},
{:swoosh, ">= 0.0.0", optional: true},
{:finch, ">= 0.12.0", optional: true},

Expand Down
Loading

0 comments on commit 00442dc

Please sign in to comment.