Skip to content

Commit 7ea4094

Browse files
committed
chore: add dialyzer to pipeline
1 parent da51387 commit 7ea4094

20 files changed

Lines changed: 121 additions & 123 deletions

.github/workflows/ci.yml

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,41 @@ on:
66

77
jobs:
88
bless:
9-
name: Bless
9+
name: Quality Assurance
1010
runs-on: ubuntu-20.04
1111
env:
1212
MIX_ENV: test
1313
EVENTSTORE_HOST: localhost
1414
EVENTSTORE_VERSION: nightly
15-
1615
steps:
1716
- name: Checkout
1817
uses: actions/checkout@v3
1918

2019
- name: Spawn docker-compose EventStoreDB container
2120
run: docker-compose up --detach eventstore
2221

23-
- name: Determine the elixir version
24-
run: echo "ELIXIR_VERSION=$(grep -h elixir .tool-versions | awk '{ print $2 }' | awk -F - '{print $1}')" >> $GITHUB_ENV
25-
26-
- name: Determine the otp version
27-
run: echo "OTP_VERSION=$(grep -h erlang .tool-versions | awk '{ print $2 }')" >> $GITHUB_ENV
28-
2922
- name: Setup Elixir and Erlang versions
3023
uses: erlef/setup-beam@v1
24+
id: beam
3125
with:
32-
otp-version: ${{ env.OTP_VERSION }}
33-
elixir-version: ${{ env.ELIXIR_VERSION }}
26+
version-file: .tool-versions
27+
version-type: strict
3428

3529
- name: Restore the deps cache
3630
uses: actions/cache@v3
3731
id: deps-cache
3832
with:
33+
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps
34+
restore-keys: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps
3935
path: deps
40-
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
41-
restore-keys: |
42-
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-
4336

4437
- name: Restore the _build cache
4538
uses: actions/cache@v3
4639
id: build-cache
4740
with:
41+
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ env.MIX_ENV }}-build
42+
restore-keys: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ env.MIX_ENV }}-build
4843
path: _build
49-
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-build-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
50-
restore-keys: |
51-
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-build-
5244

5345
- name: Fetch mix dependencies
5446
if: steps.deps-cache.outputs.cache-hit != 'true'
@@ -75,6 +67,29 @@ jobs:
7567
- name: Credo
7668
run: mix credo
7769

70+
- name: Restore PLT cache
71+
uses: actions/cache/restore@v3
72+
id: plt-cache
73+
with:
74+
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
75+
restore-keys: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
76+
path: priv/plts
77+
78+
- name: Create PLTs
79+
shell: sh
80+
if: steps.plt-cache.outputs.cache-hit != 'true'
81+
run: mix dialyzer --plt
82+
83+
- name: Save PLT cache
84+
uses: actions/cache/save@v3
85+
if: steps.plt-cache.outputs.cache-hit != 'true'
86+
with:
87+
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
88+
path: priv/plts
89+
90+
- name: Run dialyzer
91+
run: mix dialyzer --format github
92+
7893
publish-hex-package:
7994
name: Publish Hex Package ⬆️☁️
8095
runs-on: ubuntu-20.04
@@ -88,35 +103,28 @@ jobs:
88103
- name: Checkout
89104
uses: actions/checkout@v3
90105

91-
- name: Determine the elixir version
92-
run: echo "ELIXIR_VERSION=$(grep -h elixir .tool-versions | awk '{ print $2 }' | awk -F - '{print $1}')" >> $GITHUB_ENV
93-
94-
- name: Determine the otp version
95-
run: echo "OTP_VERSION=$(grep -h erlang .tool-versions | awk '{ print $2 }')" >> $GITHUB_ENV
96-
97106
- name: Setup Elixir and Erlang versions
98107
uses: erlef/setup-beam@v1
108+
id: beam
99109
with:
100-
otp-version: ${{ env.OTP_VERSION }}
101-
elixir-version: ${{ env.ELIXIR_VERSION }}
110+
version-file: .tool-versions
111+
version-type: strict
102112

103113
- name: Restore the deps cache
104114
uses: actions/cache@v3
105115
id: deps-cache
106116
with:
117+
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps
118+
restore-keys: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps
107119
path: deps
108-
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
109-
restore-keys: |
110-
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-
111120

112121
- name: Restore the _build cache
113122
uses: actions/cache@v3
114123
id: build-cache
115124
with:
125+
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ env.MIX_ENV }}-build
126+
restore-keys: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ env.MIX_ENV }}-build
116127
path: _build
117-
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-build-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
118-
restore-keys: |
119-
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-build-
120128

121129
- name: Fetch mix dependencies
122130
if: steps.deps-cache.outputs.cache-hit != 'true'

.github/workflows/compatibility.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,16 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
beam:
13-
- elixir: "1.7.4"
14-
otp: "21.3"
15-
- elixir: "1.12.3"
16-
otp: "24.0"
1712
eventstore:
1813
- 20.10.2
1914
- 22.6.0
2015
env:
2116
MIX_ENV: test
2217
EVENTSTORE_HOST: localhost
2318
EVENTSTORE_VERSION: ${{ matrix.eventstore }}
24-
2519
steps:
2620
- name: Checkout
27-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2822

2923
- name: Set the EventStoreDB version
3024
run: sed -i 's|ghcr.io/eventstore/eventstore:ci|eventstore/eventstore:${{ matrix.eventstore }}-buster-slim|g' docker-compose.yml
@@ -34,27 +28,26 @@ jobs:
3428

3529
- name: Setup Elixir and Erlang versions
3630
uses: erlef/setup-beam@v1
31+
id: beam
3732
with:
38-
otp-version: ${{ matrix.beam.otp }}
39-
elixir-version: ${{ matrix.beam.elixir }}
33+
version-file: .tool-versions
34+
version-type: strict
4035

4136
- name: Restore the deps cache
42-
uses: actions/cache@v1
37+
uses: actions/cache@v3
4338
id: deps-cache
4439
with:
40+
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps
41+
restore-keys: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps
4542
path: deps
46-
key: ${{ runner.os }}-${{ matrix.beam.elixir }}-${{ matrix.beam.otp }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
47-
restore-keys: |
48-
${{ runner.os }}-${{ matrix.beam.elixir }}-${{ matrix.beam.otp }}-${{ env.MIX_ENV }}-deps-
4943

5044
- name: Restore the _build cache
51-
uses: actions/cache@v1
45+
uses: actions/cache@v3
5246
id: build-cache
5347
with:
48+
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ env.MIX_ENV }}-build
49+
restore-keys: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ env.MIX_ENV }}-build
5450
path: _build
55-
key: ${{ runner.os }}-${{ matrix.beam.elixir }}-${{ matrix.beam.otp }}-${{ env.MIX_ENV }}-build-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
56-
restore-keys: |
57-
${{ runner.os }}-${{ matrix.beam.elixir }}-${{ matrix.beam.otp }}-${{ env.MIX_ENV }}-build-
5851

5952
- name: Fetch mix dependencies
6053
if: steps.deps-cache.outputs.cache-hit != 'true'
@@ -72,6 +65,3 @@ jobs:
7265

7366
- name: Run tests
7467
run: mix test --exclude version_incompatible
75-
76-
- name: Credo
77-
run: mix credo

.github/workflows/refresh-dev-cache.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,14 @@ jobs:
3737

3838
steps:
3939
- name: Checkout
40-
uses: actions/checkout@v2
41-
42-
- name: Determine the elixir version
43-
run: echo "ELIXIR_VERSION=$(grep -h elixir .tool-versions | awk '{ print $2 }' | awk -F - '{print $1}')" >> $GITHUB_ENV
44-
45-
- name: Determine the otp version
46-
run: echo "OTP_VERSION=$(grep -h erlang .tool-versions | awk '{ print $2 }')" >> $GITHUB_ENV
40+
uses: actions/checkout@v3
4741

4842
- name: Setup Elixir and Erlang versions
49-
uses: erlef/setup-beam@v1.7.0
43+
uses: erlef/setup-beam@v1
44+
id: beam
5045
with:
51-
otp-version: ${{ env.OTP_VERSION }}
52-
elixir-version: ${{ env.ELIXIR_VERSION }}
46+
version-file: .tool-versions
47+
version-type: strict
5348

5449
- name: Restore the deps cache
5550
uses: actions/cache@v1

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ erl_crash.dump
2222
# Ignore package tarball (built via "mix hex.build").
2323
spear-*.tar
2424

25-
2625
# Temporary files for e.g. tests
2726
/tmp
27+
28+
/priv/plts/*.plt
29+
/priv/plts/*.plt.hash

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
elixir 1.12.3-otp-24
2-
erlang 24.0
1+
elixir 1.14.5-otp-26
2+
erlang 26.0

config/config.exs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
use Mix.Config
1+
import Config
22

3-
import_config "#{Mix.env()}.exs"
3+
config :spear, Spear.Test.ClientFixture, connection_string: "esdb://localhost:2113"
4+
5+
host = System.get_env("EVENTSTORE_HOST") || "localhost"
6+
7+
config :spear, :config,
8+
connection_string: "esdb://admin:changeit@#{host}:2113?tls=true",
9+
mint_opts: [
10+
transport_opts: [
11+
cacertfile: Path.join([__DIR__ | ~w(.. eventstoredb certs ca ca.crt)])
12+
]
13+
]

config/dev.exs

Lines changed: 0 additions & 1 deletion
This file was deleted.

config/prod.exs

Lines changed: 0 additions & 1 deletion
This file was deleted.

config/test.exs

Lines changed: 0 additions & 13 deletions
This file was deleted.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
# messages via wireshark
1414
# command: "--insecure --run-projections=All"
1515
ports:
16-
- 2113:2113
16+
- '2113:2113'
1717

1818
app:
1919
image: elixir:1.12.2

0 commit comments

Comments
 (0)