Skip to content

Commit 3be74e4

Browse files
committed
Make when to run lint/dialyzer more flexible
Removes the duplication on the elixir versions that was error prone and needed updating. Also would allow us to run it on more versions. With friendly inspiration from mint: https://github.com/elixir-mint/mint/blob/90ee9fdb27c0d52b374b8d689c54d8559b2bb57c/.github/workflows/main.yml
1 parent 7ba8a79 commit 3be74e4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
otp_version: '26.2'
4646
- elixir_version: '1.18'
4747
otp_version: '27.3'
48+
type_check: true
49+
lint: true
4850

4951
steps:
5052
- name: Checkout
@@ -66,26 +68,27 @@ jobs:
6668
with:
6769
path: tools/plts
6870
key: erlef-${{ runner.os }}-dialyzer-${{ matrix.elixir_version }}-${{ matrix.otp_version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
69-
if: contains(matrix.elixir_version, '1.18')
71+
if: ${{ matrix.type_check }}
7072
- run: mix deps.get
7173
- run: MIX_ENV=test mix compile --warnings-as-errors
7274
- run: mix credo
73-
if: contains(matrix.elixir_version, '1.18')
75+
if: ${{ matrix.lint }}
7476
- name: Check if formatted
75-
if: contains(matrix.elixir_version, '1.18')
77+
if: ${{ matrix.lint }}
7678
run: mix format --check-formatted
7779
- name: Actual Tests
7880
# this will let warnings slip through but I don't wanna replicate all that magic
7981
# right now
8082
run: MIX_ENV=test mix coveralls.github || mix test --failed
8183
# Apparently the one with `!` can't go without the fancy expression syntax
82-
if: ${{ !contains(matrix.elixir_version, '1.18') }}
84+
if: ${{ !matrix.lint }}
85+
# warnings as errors is a form of linting!
8386
- name: Actual Tests WITH warnings as errors
8487
run: MIX_ENV=test mix coveralls.github --warnings-as-errors || mix test --failed
85-
if: contains(matrix.elixir_version, '1.18')
88+
if: ${{ matrix.lint }}
8689
- name: Dialyzer
8790
run: mix dialyzer --halt-exit-status
88-
if: contains(matrix.elixir_version, '1.18')
91+
if: ${{ matrix.type_check }}
8992

9093
macos:
9194
name: Test on MacOS

0 commit comments

Comments
 (0)