-
Notifications
You must be signed in to change notification settings - Fork 171
115 lines (100 loc) · 3.54 KB
/
elixir_tests.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
112
113
114
115
name: Elixir CI
on:
push:
branches: ["main"]
paths-ignore:
- "website/**"
- "**/README.md"
pull_request:
paths-ignore:
- "website/**"
- "**/README.md"
permissions:
contents: read
jobs:
build_and_test:
name: "Build and test, Postgres ${{ matrix.postgres_version }}"
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/sync-service
strategy:
matrix:
postgres_version: [14, 15]
env:
MIX_ENV: test
POSTGRES_VERSION: "${{ matrix.postgres_version }}0000"
services:
postgres:
image: "postgres:${{ matrix.postgres_version }}-alpine"
env:
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54321:5432
steps:
- uses: actions/checkout@v4
- name: "Set PG settings"
run: |
docker exec ${{ job.services.postgres.id }} sh -c 'echo "wal_level=logical" >> /var/lib/postgresql/data/postgresql.conf'
docker restart ${{ job.services.postgres.id }}
- uses: erlef/setup-beam@v1
with:
version-type: strict
version-file: ".tool-versions"
- name: Cache dependencies
uses: actions/cache@v4
with:
path: packages/sync-service/deps
key: "${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}"
restore-keys: |
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-deps-
- name: Cache compiled code
uses: actions/cache@v4
with:
path: |
packages/sync-service/_build/*/lib
!packages/sync-service/_build/*/lib/electric
key: "${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-${{ github.sha }}"
restore-keys: |
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-${{ github.sha }}
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-build-
- name: Install dependencies
run: mix deps.get && mix deps.compile
- name: Compiles without warnings
run: mix compile --force --all-warnings --warnings-as-errors
- name: Run tests
run: mix test
formatting:
name: Check formatting
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/sync-service
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
version-type: strict
version-file: ".tool-versions"
- name: Restore dependencies cache
uses: actions/cache/restore@v4
with:
path: packages/sync-service/deps
key: "${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}"
restore-keys: |
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-deps-
- run: mix deps.get
- run: mix format --check-formatted