This repository has been archived by the owner on Jan 30, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 81
111 lines (92 loc) · 2.82 KB
/
test.yml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Test
on:
push:
branches:
- main
pull_request:
env:
MIX_ENV: test
ELIXIR_VERSION: 1.17.1
OTP_VERSION: 26.2.5
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:15
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
stripemock:
image: stripe/stripe-mock:latest
ports: ["12111:12111"]
steps:
- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
elixir-version: ${{env.ELIXIR_VERSION}}
otp-version: ${{env.OTP_VERSION}}
- name: Checkout code
uses: actions/checkout@v4
- name: Restore dependencies cache
id: cache-deps
uses: actions/cache@v4
env:
cache-name: cache-elixir-deps
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
- name: Restore build cache
id: cache-build
uses: actions/cache@v4
env:
cache-name: cache-compiled-build
with:
path: _build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
- name: Restore PLT cache
uses: actions/cache@v4
id: plt_cache
with:
key: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-plt
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-plt
path: |
priv/plts
- name: Install dependencies
run: mix deps.get
shell: bash
- name: Compile app
run: mix compile --all-warnings --warnings-as-errors
- name: Check formatter
run: mix format --check-formatted
- name: Lint
run: mix credo --strict
- name: Scan security vulnerabilities
run: mix sobelow -i Config.HTTPS --skip --exit
- name: Audit dependencies
run: mix deps.audit
- name: Scan retired dependencies
run: mix hex.audit
# Create PLTs if no cache was found
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
- name: Run dialyzer
run: mix dialyzer --format github
- name: Run tests
run: mix test