Skip to content

Commit b8bc6fd

Browse files
Fix CI
1 parent 2a6e94b commit b8bc6fd

5 files changed

Lines changed: 128 additions & 123 deletions

File tree

.github/workflows/config.yml

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,81 @@
1-
name: Github Actions CI
2-
3-
on:
4-
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
8-
jobs:
9-
build:
10-
# Containers must run in Linux based operating systems
11-
runs-on: ubuntu-20.04
12-
name: Build and test
13-
env:
14-
MIX_ENV: test
15-
16-
strategy:
17-
matrix:
18-
otp: ['26.2']
19-
elixir: ['1.15.7']
20-
21-
services:
22-
postgres:
23-
image: postgres:13-alpine
24-
env:
25-
POSTGRES_USER: postgres
26-
POSTGRES_PASSWORD: postgres
27-
POSTGRES_DB: bitcrowd_ecto_test
28-
ports:
29-
- 5432:5432
30-
options: >-
31-
--health-cmd pg_isready
32-
--health-interval 10s
33-
--health-timeout 5s
34-
--health-retries 5
35-
36-
steps:
37-
- name: Check out repository code
38-
uses: actions/checkout@v3
39-
40-
- name: Set up Elixir
41-
uses: erlef/setup-beam@v1
42-
with:
43-
otp-version: ${{matrix.otp}}
44-
elixir-version: ${{matrix.elixir}}
45-
version-type: 'strict'
46-
47-
- run: mix local.hex --force
48-
- run: mix local.rebar --force
49-
50-
- name: Restore dependencies cache
51-
uses: actions/cache@v3
52-
with:
53-
path: deps
54-
key: v1-mix-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}
55-
restore-keys: v1-mix-${{ runner.os }}
56-
57-
- name: Restore build cache
58-
uses: actions/cache@v3
59-
with:
60-
path: _build
61-
key: v1-build-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}
62-
restore-keys: v1-build-${{ runner.os }}
63-
64-
- name: Install dependencies
65-
run: mix do deps.get, compile
66-
67-
- name: Restore plts cache
68-
uses: actions/cache@v3
69-
with:
70-
path: _plts
71-
key: v1-plt-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}
72-
restore-keys: v1-plt-${{ runner.os }}
73-
74-
- name: Linter
75-
run: mix lint
76-
77-
- name: Init DB
78-
run: mix do ecto.create, ecto.migrate
79-
80-
- name: Run tests
81-
run: mix test
1+
name: Github Actions CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
# Containers must run in Linux based operating systems
11+
runs-on: ubuntu-24.04
12+
name: Build and test
13+
env:
14+
MIX_ENV: test
15+
16+
strategy:
17+
matrix:
18+
otp: ["28.3"]
19+
elixir: ["1.19.4"]
20+
21+
services:
22+
postgres:
23+
image: postgres:17-alpine
24+
env:
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
POSTGRES_DB: bitcrowd_ecto_test
28+
ports:
29+
- 5432:5432
30+
options: >-
31+
--health-cmd pg_isready
32+
--health-interval 10s
33+
--health-timeout 5s
34+
--health-retries 5
35+
36+
steps:
37+
- name: Check out repository code
38+
uses: actions/checkout@v3
39+
40+
- name: Set up Elixir
41+
uses: erlef/setup-beam@v1
42+
with:
43+
otp-version: ${{matrix.otp}}
44+
elixir-version: ${{matrix.elixir}}
45+
version-type: "strict"
46+
47+
- run: mix local.hex --force
48+
- run: mix local.rebar --force
49+
50+
- name: Restore dependencies cache
51+
uses: actions/cache@v3
52+
with:
53+
path: deps
54+
key: v1-mix-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}
55+
restore-keys: v1-mix-${{ runner.os }}
56+
57+
- name: Restore build cache
58+
uses: actions/cache@v3
59+
with:
60+
path: _build
61+
key: v1-build-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}
62+
restore-keys: v1-build-${{ runner.os }}
63+
64+
- name: Install dependencies
65+
run: mix do deps.get, compile
66+
67+
- name: Restore plts cache
68+
uses: actions/cache@v3
69+
with:
70+
path: _plts
71+
key: v1-plt-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}
72+
restore-keys: v1-plt-${{ runner.os }}
73+
74+
- name: Linter
75+
run: mix lint
76+
77+
- name: Init DB
78+
run: mix do ecto.create, ecto.migrate
79+
80+
- name: Run tests
81+
run: mix test

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
elixir 1.15.7
2-
erlang 26.2
1+
elixir 1.19.4
2+
erlang 28.3

lib/bitcrowd_ecto/changeset.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,9 @@ defmodule BitcrowdEcto.Changeset do
517517
{:parameterized, Ecto.Embedded, _} ->
518518
:embeds
519519

520+
{:parameterized, {Ecto.Embedded, _}} ->
521+
:embeds
522+
520523
# Simplification, can be extended as needed.
521524
_other ->
522525
:scalars
@@ -527,9 +530,7 @@ defmodule BitcrowdEcto.Changeset do
527530
end
528531

529532
defp cast_scalars(schema_struct, params, scalars, required) do
530-
# Don't be confused, `--` is right-associative.
531-
# https://hexdocs.pm/elixir/1.15.7/operators.html#operator-precedence-and-associativity
532-
required = scalars -- scalars -- required
533+
required = scalars -- (scalars -- required)
533534

534535
schema_struct
535536
|> Ecto.Changeset.cast(params, scalars)

mix.exs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule BitcrowdEcto.MixProject do
1515
deps: deps(),
1616
dialyzer: dialyzer(),
1717
elixirc_paths: elixirc_paths(Mix.env()),
18-
preferred_cli_env: [lint: :test],
18+
cli: cli(),
1919

2020
# hex.pm
2121
package: package(),
@@ -29,6 +29,10 @@ defmodule BitcrowdEcto.MixProject do
2929
]
3030
end
3131

32+
def cli do
33+
[preferred_envs: [lint: :test]]
34+
end
35+
3236
defp package do
3337
[
3438
maintainers: ["@bitcrowd"],
@@ -76,16 +80,16 @@ defmodule BitcrowdEcto.MixProject do
7680

7781
defp deps do
7882
[
79-
{:ecto, "~> 3.6"},
80-
{:ecto_sql, "~> 3.6"},
83+
{:ecto, "~> 3.13"},
84+
{:ecto_sql, "~> 3.13"},
8185
{:ex_money, "~> 5.12", optional: true},
8286
{:ex_money_sql, "~> 1.7", only: [:dev, :test]},
8387
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
8488
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
8589
{:ex_doc, "> 0.0.0", only: [:dev], runtime: false},
8690
{:ex_machina, "~> 2.7", only: [:dev, :test]},
8791
{:junit_formatter, "~> 3.3", only: [:test]},
88-
{:postgrex, "> 0.0.0", only: [:dev, :test]},
92+
{:postgrex, "> 0.19.0", only: [:dev, :test]},
8993
{:tzdata, "> 0.0.0", only: [:dev, :test]},
9094
# NOTE: https://github.com/kipcole9/money/issues/142
9195
{:jason, "> 0.0.0", optional: true}

0 commit comments

Comments
 (0)