-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (75 loc) · 2.42 KB
/
ci.yml
File metadata and controls
87 lines (75 loc) · 2.42 KB
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
80
81
82
83
84
85
86
87
name: Elixir CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
#
# run test suite
#
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
id: beam
with:
elixir-version: "1.18.3"
otp-version: "OTP-27"
- uses: foundry-rs/foundry-toolchain@v1
- uses: actions/cache@v4
with:
path: |
server/deps
server/_build
key: ${{ runner.os }}-mix-${{ hashFiles('server/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
# Cache key based on Erlang/Elixir version and the mix.lock hash
- name: Restore PLT cache
id: plt_cache
uses: actions/cache/restore@v3
with:
key: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
path: |
server/priv/plts
- name: Install dependencies
run: mix deps.get
# Create PLTs if no cache was found
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
# By default, the GitHub Cache action will only save the cache if all steps in the job succeed,
# so we separate the cache restore and save steps in case running dialyzer fails.
- name: Save PLT cache
id: plt_cache_save
uses: actions/cache/save@v3
if: steps.plt_cache.outputs.cache-hit != 'true'
with:
key: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
path: |
server/priv/plts
- name: Compile
run: mix compile
- name: Create database
run: mix ecto.create
- name: Run migrations
run: mix ecto.migrate
- name: Run Credo
run: mix credo
- name: Run dialyzer
run: mix dialyzer --format github --format dialyxir
- name: Run tests
run: mix test