-
Notifications
You must be signed in to change notification settings - Fork 78
106 lines (90 loc) · 2.9 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
name: Mix Tests
on:
push:
branches: [master, v2]
pull_request:
branches: [master, v2]
jobs:
build:
name: Elixir ${{ matrix.elixir }} with OTP ${{ matrix.otp }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
elixir:
- '1.17'
- '1.16'
- '1.15'
otp:
- '27.0'
- '26.2'
- '25.3'
- '24.3'
exclude:
- elixir: '1.17'
otp: '24.3'
- elixir: '1.16'
otp: '27.0'
- elixir: '1.15'
otp: '27.0'
services:
postgres:
image: postgres:16
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 3
redis:
image: redis
ports: ['6379:6379']
steps:
- name: Start Default MySQL 5.7
run: sudo /etc/init.d/mysql start
- name: 'Wait for MySQL to be ready (TODO: needs timeout)'
run: |
while ! mysqladmin ping -h"127.0.0.1" -uroot -proot -P3306 --silent >/dev/null 2>&1; do
sleep 1
done
- name: Set up Elixir and OTP
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Checkout code
uses: actions/checkout@v4
- name: 'Restore cache for deps/ and _build/ directories'
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-test-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-test-${{ matrix.elixir }}-${{ matrix.otp }}-
# - name: '[DEBUG] List cached dirs'
# run: |
# ls -la deps
# ls -la _build
# ls -la _build/test/lib
- name: Install Mix dependencies
run: mix deps.get
- name: Create and migrate the DB on Postgres
run: |
MIX_ENV=test PERSISTENCE=ecto RDBMS=postgres mix compile --warnings-as-errors
MIX_ENV=test PERSISTENCE=ecto RDBMS=postgres mix do ecto.create, ecto.migrate
rm -rf _build/test/lib/fun_with_flags
- name: Create and migrate the DB on MySQL
run: |
MIX_ENV=test PERSISTENCE=ecto RDBMS=mysql mix compile --warnings-as-errors
MIX_ENV=test PERSISTENCE=ecto RDBMS=mysql mix do ecto.create, ecto.migrate
rm -rf _build/test/lib/fun_with_flags
- name: Create and migrate the DB on SQLite
run: |
MIX_ENV=test PERSISTENCE=ecto RDBMS=sqlite mix compile --warnings-as-errors
MIX_ENV=test PERSISTENCE=ecto RDBMS=sqlite mix do ecto.create, ecto.migrate
rm -rf _build/test/lib/fun_with_flags
- name: Run all tests
run: mix test.all