Skip to content

Commit 894ef07

Browse files
authored
Fix CI to run tests on host with matrix versions (#135)
- Run mix commands directly instead of through Docker - Use Postgres service container - Set up database schema before running tests
1 parent a5a754e commit 894ef07

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@ jobs:
1818
strategy:
1919
matrix:
2020
elixir: ["1.17.x", "1.18.x", "1.19.x"]
21-
otp: ["26.x", "27.x", "28.x"]
21+
otp: ["26.x", "27.x"]
22+
23+
services:
24+
db:
25+
image: postgres:13-alpine
26+
env:
27+
POSTGRES_DB: phx_admin_dev
28+
POSTGRES_PASSWORD: postgres
29+
POSTGRES_USER: postgres
30+
POSTGRES_HOST_AUTH_METHOD: trust
31+
ports:
32+
- 5432:5432
33+
options: >-
34+
--health-cmd pg_isready
35+
--health-interval 10s
36+
--health-timeout 5s
37+
--health-retries 5
2238
2339
steps:
2440
- uses: actions/checkout@v2
@@ -34,12 +50,12 @@ jobs:
3450
_build
3551
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
3652
- name: Get deps
37-
run: docker compose run app mix deps.get
53+
run: mix deps.get
3854
- name: Compile deps
39-
run: docker compose run app mix deps.compile
55+
run: mix deps.compile
4056
- name: Check for uncommitted changes
4157
run: exit $( git status --porcelain | head -255 | wc -l )
58+
- name: Set up database
59+
run: PGPASSWORD=postgres psql -h 127.0.0.1 -U postgres -d phx_admin_dev -f dev/initdb/structure.sql
4260
- name: Run tests
43-
run: docker compose run -e MIX_ENV=test app mix do compile --warnings-as-errors, test
44-
- name: Check dev
45-
run: docker compose up --wait
61+
run: mix do compile --warnings-as-errors + test

lib/live_admin.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ defmodule LiveAdmin do
109109
with result = {_, m, f, _} <-
110110
extract_function_from_config(resource, config, function_type, function),
111111
docs when is_map(docs) <- extract_function_docs(m, f) do
112-
Tuple.append(result, docs)
112+
Tuple.insert_at(result, tuple_size(result), docs)
113113
end
114114
end
115115

0 commit comments

Comments
 (0)