-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (74 loc) · 2.5 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Inspired by a combination of:
# - https://github.com/rrrene/credo/blob/master/.github/workflows/ci-workflow.yml
# - https://elixirforum.com/t/using-github-action-cache/37922/2
name: "Lint and test"
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-22.04
env:
ImageOS: ubuntu22
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: beam
with:
otp-version: '25'
elixir-version: '1.15'
# Dependencies.
- name: Restore dependencies cache
uses: actions/cache@v2
id: deps_cache
with:
key: |
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps
path: |
deps
- name: Download dependencies
run: mix deps.get
- name: Compile dependencies
run: mix deps.compile
# Build.
- name: Restore build cache
uses: actions/cache@v2
id: build_cache
with:
key: |
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-build
path: |
_build
- name: Compile project
run: mix compile --warnings-as-errors
# Formatting, linting, and type checking.
- name: Check formatting
run: mix format --check-formatted
- name: Check lint
run: mix credo --strict
- 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
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
- name: Check typespecs
run: mix dialyzer --format github
# Tests.
- name: Check tests
run: mix test