Skip to content

Commit d343d60

Browse files
authored
upgrade CI, format (#125)
1 parent 59f1b36 commit d343d60

5 files changed

Lines changed: 56 additions & 21 deletions

File tree

.formatter.exs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# Used by "mix format"
21
[
3-
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
2+
inputs: [
3+
"{mix,.formatter}.exs",
4+
"{config,lib,test}/**/*.{ex,exs}"
5+
],
46
line_length: 88
57
]

.github/workflows/ci.yml

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,47 @@
11
name: CI
2-
on: [push, pull_request]
3-
jobs:
4-
test-elixir:
5-
runs-on: ubuntu-latest
6-
container: elixir:${{ matrix.elixir_version }}-slim
72

3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-20.04
12+
env:
13+
MIX_ENV: test
814
strategy:
15+
fail-fast: false
916
matrix:
10-
elixir_version: ["1.8", "1.9", "1.10", "1.11"]
11-
17+
include:
18+
- pair:
19+
elixir: 1.8.2
20+
otp: 20.3.8.26
21+
- pair:
22+
elixir: 1.11.4
23+
otp: 23.2.7
24+
lint: lint
1225
steps:
1326
- uses: actions/checkout@v2
1427

15-
- name: Install system dependencies
16-
run: |
17-
apt-get update
18-
apt-get install --no-install-recommends -y git build-essential
19-
mix local.rebar --force
20-
mix local.hex --force
21-
mix deps.get
28+
- uses: erlef/setup-elixir@v1
29+
with:
30+
otp-version: ${{matrix.pair.otp}}
31+
elixir-version: ${{matrix.pair.elixir}}
32+
33+
- name: Install Dependencies
34+
run: mix deps.get --only test
35+
36+
- run: mix format --check-formatted
37+
if: ${{ matrix.lint }}
38+
39+
- run: mix deps.get && mix deps.unlock --check-unused
40+
if: ${{ matrix.lint }}
41+
42+
- run: mix deps.compile
43+
44+
- run: mix compile --warnings-as-errors
45+
if: ${{ matrix.lint }}
2246

2347
- run: mix test

lib/exqlite/connection.ex

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,11 @@ defmodule Exqlite.Connection do
205205
def handle_commit(options, %{transaction_status: transaction_status} = state) do
206206
case Keyword.get(options, :mode, :deferred) do
207207
:savepoint when transaction_status == :transaction ->
208-
handle_transaction(:commit_savepoint, "RELEASE SAVEPOINT exqlite_savepoint", state)
208+
handle_transaction(
209+
:commit_savepoint,
210+
"RELEASE SAVEPOINT exqlite_savepoint",
211+
state
212+
)
209213

210214
mode
211215
when mode in [:deferred, :immediate, :exclusive, :transaction] and
@@ -224,7 +228,11 @@ defmodule Exqlite.Connection do
224228
"ROLLBACK TO SAVEPOINT exqlite_savepoint",
225229
state
226230
) do
227-
handle_transaction(:rollback_savepoint, "RELEASE SAVEPOINT exqlite_savepoint", state)
231+
handle_transaction(
232+
:rollback_savepoint,
233+
"RELEASE SAVEPOINT exqlite_savepoint",
234+
state
235+
)
228236
end
229237

230238
mode
@@ -498,6 +506,7 @@ defmodule Exqlite.Connection do
498506
columns: [],
499507
num_rows: 0
500508
}
509+
501510
{:ok, result, %{state | transaction_status: transaction_status}}
502511
else
503512
{:error, reason} ->

lib/exqlite/result.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Exqlite.Result do
33
command: atom,
44
columns: [String.t()] | nil,
55
rows: [[term] | term] | nil,
6-
num_rows: integer(),
6+
num_rows: integer()
77
}
88

99
defstruct command: nil, columns: [], rows: [], num_rows: 0
@@ -13,7 +13,7 @@ defmodule Exqlite.Result do
1313
command: Keyword.get(options, :command),
1414
columns: Keyword.get(options, :columns, []),
1515
rows: Keyword.get(options, :rows, []),
16-
num_rows: Keyword.get(options, :num_rows, 0),
16+
num_rows: Keyword.get(options, :num_rows, 0)
1717
}
1818
end
1919
end

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ defmodule Exqlite.MixProject do
3636
[
3737
{:db_connection, "~> 2.1"},
3838
{:elixir_make, "~> 0.6", runtime: false},
39-
{:ex_doc, "~> 0.24", only: [:dev], runtime: false},
39+
{:ex_doc, "~> 0.24", only: [:docs], runtime: false},
4040
{:temp, "~> 0.4", only: [:test]}
4141
]
4242
end

0 commit comments

Comments
 (0)