Skip to content

Commit 18a1424

Browse files
authored
Add Github Actions (#83)
* add github actions * Remove v1.10 * don't test compile * mix format * add pg database * add cache
1 parent e130f28 commit 18a1424

File tree

3 files changed

+138
-1
lines changed

3 files changed

+138
-1
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
open-pull-requests-limit: 99
8+
- package-ecosystem: mix
9+
directory: "/"
10+
schedule:
11+
interval: "monthly"
12+
open-pull-requests-limit: 99

.github/workflows/elixir.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Elixir
2+
on: push
3+
4+
env:
5+
MIX_ENV: test
6+
7+
# https://github.com/elixir-lang/elixir/blob/master/lib/elixir/pages/compatibility-and-deprecations.md
8+
jobs:
9+
elixir_1_13:
10+
runs-on: ubuntu-latest
11+
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
12+
strategy:
13+
matrix:
14+
otp: [22.x, 23.x, 24.x]
15+
elixir: [1.13.x]
16+
services:
17+
postgres:
18+
image: postgres:14
19+
env:
20+
POSTGRES_USER: postgres
21+
POSTGRES_PASSWORD: postgres
22+
POSTGRES_DB: ex_audit_test
23+
ports:
24+
- 5432:5432
25+
options: >-
26+
--health-cmd pg_isready
27+
--health-interval 10s
28+
--health-timeout 5s
29+
--health-retries 5
30+
steps:
31+
- uses: actions/checkout@v2
32+
- uses: erlef/setup-beam@v1
33+
with:
34+
otp-version: ${{matrix.otp}}
35+
elixir-version: ${{matrix.elixir}}
36+
- uses: actions/cache@v3
37+
with:
38+
path: |
39+
deps
40+
_build
41+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-mix-
44+
- run: mix do deps.get
45+
# - run: mix compile --warnings-as-errors
46+
- run: mix format --dry-run --check-formatted
47+
- run: mix test
48+
49+
elixir_1_12:
50+
runs-on: ubuntu-latest
51+
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
52+
strategy:
53+
matrix:
54+
otp: [22.x, 23.x, 24.x]
55+
elixir: [1.12.x]
56+
services:
57+
postgres:
58+
image: postgres:14
59+
env:
60+
POSTGRES_USER: postgres
61+
POSTGRES_PASSWORD: postgres
62+
POSTGRES_DB: ex_audit_test
63+
ports:
64+
- 5432:5432
65+
options: >-
66+
--health-cmd pg_isready
67+
--health-interval 10s
68+
--health-timeout 5s
69+
--health-retries 5
70+
steps:
71+
- uses: actions/checkout@v2
72+
- uses: erlef/setup-beam@v1
73+
with:
74+
otp-version: ${{matrix.otp}}
75+
elixir-version: ${{matrix.elixir}}
76+
- uses: actions/cache@v3
77+
with:
78+
path: |
79+
deps
80+
_build
81+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
82+
restore-keys: |
83+
${{ runner.os }}-mix-
84+
- run: mix do deps.get
85+
# - run: mix compile --warnings-as-errors
86+
- run: mix format --dry-run --check-formatted
87+
- run: mix test
88+
89+
elixir_1_11:
90+
runs-on: ubuntu-latest
91+
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
92+
strategy:
93+
matrix:
94+
otp: [21.x, 22.x, 23.x, 24.x]
95+
elixir: [1.11.x]
96+
services:
97+
postgres:
98+
image: postgres:14
99+
env:
100+
POSTGRES_USER: postgres
101+
POSTGRES_PASSWORD: postgres
102+
POSTGRES_DB: ex_audit_test
103+
ports:
104+
- 5432:5432
105+
options: >-
106+
--health-cmd pg_isready
107+
--health-interval 10s
108+
--health-timeout 5s
109+
--health-retries 5
110+
steps:
111+
- uses: actions/checkout@v2
112+
- uses: erlef/setup-beam@v1
113+
with:
114+
otp-version: ${{matrix.otp}}
115+
elixir-version: ${{matrix.elixir}}
116+
- uses: actions/cache@v3
117+
with:
118+
path: |
119+
deps
120+
_build
121+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
122+
restore-keys: |
123+
${{ runner.os }}-mix-
124+
- run: mix do deps.get
125+
# - run: mix compile --warnings-as-errors
126+
- run: mix test

test/test_helper.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
ExAudit.Test.Repo.start_link()
33
Ecto.Adapters.SQL.Sandbox.mode(ExAudit.Test.Repo, :auto)
44

5-
65
migrations_path = Path.join([:code.priv_dir(:ex_audit), "repo", "migrations"])
76
Ecto.Migrator.run(ExAudit.Test.Repo, migrations_path, :up, all: true)
87

0 commit comments

Comments
 (0)