From 5ab9ffebf3d908cfd7294a7a2cc918694af8e425 Mon Sep 17 00:00:00 2001 From: Kevin Lang Date: Mon, 22 Mar 2021 19:53:11 -0400 Subject: [PATCH 1/6] upgrade CI, add windows CI --- .formatter.exs | 6 +++-- .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++++----------- lib/exqlite/connection.ex | 13 ++++++++-- lib/exqlite/result.ex | 4 +-- mix.exs | 2 +- 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/.formatter.exs b/.formatter.exs index ee23f8d9..4763d0a0 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,5 +1,7 @@ -# Used by "mix format" [ - inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"], + inputs: [ + "{mix,.formatter}.exs", + "{config,lib,test}/**/*.{ex,exs}" + ], line_length: 88 ] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93adbb6b..abac5ccf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,23 +1,48 @@ name: CI -on: [push, pull_request] -jobs: - test-elixir: - runs-on: ubuntu-latest - container: elixir:${{ matrix.elixir_version }}-slim +on: + pull_request: + push: + branches: + - master + +jobs: + test: + runs-on: ${{ matrix.os }} + env: + MIX_ENV: test strategy: + fail-fast: false matrix: - elixir_version: ["1.8", "1.9", "1.10", "1.11"] - + os: [windows-latest, ubuntu-latest] + include: + - pair: + elixir: 1.5.3 + otp: 19.3.6.13 + - pair: + elixir: 1.11.3 + otp: 23.2.5 + lint: lint steps: - uses: actions/checkout@v2 - - name: Install system dependencies - run: | - apt-get update - apt-get install --no-install-recommends -y git build-essential - mix local.rebar --force - mix local.hex --force - mix deps.get + - uses: erlef/setup-elixir@v1 + with: + otp-version: ${{matrix.pair.otp}} + elixir-version: ${{matrix.pair.elixir}} + + - name: Install Dependencies + run: mix deps.get --only test + + - run: mix format --check-formatted + if: ${{ matrix.lint }} + + - run: mix deps.get && mix deps.unlock --check-unused + if: ${{ matrix.lint }} + + - run: mix deps.compile + + - run: mix compile --warnings-as-errors + if: ${{ matrix.lint }} - run: mix test diff --git a/lib/exqlite/connection.ex b/lib/exqlite/connection.ex index 0e2db8c7..291a0285 100644 --- a/lib/exqlite/connection.ex +++ b/lib/exqlite/connection.ex @@ -205,7 +205,11 @@ defmodule Exqlite.Connection do def handle_commit(options, %{transaction_status: transaction_status} = state) do case Keyword.get(options, :mode, :deferred) do :savepoint when transaction_status == :transaction -> - handle_transaction(:commit_savepoint, "RELEASE SAVEPOINT exqlite_savepoint", state) + handle_transaction( + :commit_savepoint, + "RELEASE SAVEPOINT exqlite_savepoint", + state + ) mode when mode in [:deferred, :immediate, :exclusive, :transaction] and @@ -224,7 +228,11 @@ defmodule Exqlite.Connection do "ROLLBACK TO SAVEPOINT exqlite_savepoint", state ) do - handle_transaction(:rollback_savepoint, "RELEASE SAVEPOINT exqlite_savepoint", state) + handle_transaction( + :rollback_savepoint, + "RELEASE SAVEPOINT exqlite_savepoint", + state + ) end mode @@ -498,6 +506,7 @@ defmodule Exqlite.Connection do columns: [], num_rows: 0 } + {:ok, result, %{state | transaction_status: transaction_status}} else {:error, reason} -> diff --git a/lib/exqlite/result.ex b/lib/exqlite/result.ex index 454ad051..c224905a 100644 --- a/lib/exqlite/result.ex +++ b/lib/exqlite/result.ex @@ -3,7 +3,7 @@ defmodule Exqlite.Result do command: atom, columns: [String.t()] | nil, rows: [[term] | term] | nil, - num_rows: integer(), + num_rows: integer() } defstruct command: nil, columns: [], rows: [], num_rows: 0 @@ -13,7 +13,7 @@ defmodule Exqlite.Result do command: Keyword.get(options, :command), columns: Keyword.get(options, :columns, []), rows: Keyword.get(options, :rows, []), - num_rows: Keyword.get(options, :num_rows, 0), + num_rows: Keyword.get(options, :num_rows, 0) } end end diff --git a/mix.exs b/mix.exs index 96434ec7..d63a1cdc 100644 --- a/mix.exs +++ b/mix.exs @@ -36,7 +36,7 @@ defmodule Exqlite.MixProject do [ {:db_connection, "~> 2.1"}, {:elixir_make, "~> 0.6", runtime: false}, - {:ex_doc, "~> 0.24", only: [:dev], runtime: false}, + {:ex_doc, "~> 0.24", only: [:docs], runtime: false}, {:temp, "~> 0.4", only: [:test]} ] end From bd2e28ddcee67fc50dbe1ed597896599d592c220 Mon Sep 17 00:00:00 2001 From: Kevin Lang Date: Mon, 22 Mar 2021 19:59:57 -0400 Subject: [PATCH 2/6] windows not supported --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abac5ccf..5344f487 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,13 +8,12 @@ on: jobs: test: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest env: MIX_ENV: test strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-latest] include: - pair: elixir: 1.5.3 From bca876d14cfaa4de61d609b13df1edfcfeb088bb Mon Sep 17 00:00:00 2001 From: Kevin Lang Date: Mon, 22 Mar 2021 20:03:19 -0400 Subject: [PATCH 3/6] better version range --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5344f487..74aa63ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 env: MIX_ENV: test strategy: @@ -16,11 +16,11 @@ jobs: matrix: include: - pair: - elixir: 1.5.3 + elixir: 1.6.6 otp: 19.3.6.13 - pair: - elixir: 1.11.3 - otp: 23.2.5 + elixir: 1.11.4 + otp: 23.2.7 lint: lint steps: - uses: actions/checkout@v2 From 6285f2ba95c8795a8faf007575e429c6b344c457 Mon Sep 17 00:00:00 2001 From: Kevin Lang Date: Mon, 22 Mar 2021 20:08:16 -0400 Subject: [PATCH 4/6] try 20.04 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74aa63ce..872fd172 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 env: MIX_ENV: test strategy: From fa8e9760fd6ca02bf24c29b5aef38a2c97947d14 Mon Sep 17 00:00:00 2001 From: Kevin Lang Date: Mon, 22 Mar 2021 20:10:50 -0400 Subject: [PATCH 5/6] try bumping min to 1.8 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 872fd172..f6c3c534 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: matrix: include: - pair: - elixir: 1.6.6 - otp: 19.3.6.13 + elixir: 1.8.2 + otp: 20.3.8.26 - pair: elixir: 1.11.4 otp: 23.2.7 From 8d0873d2c0b04436c994e7d41870842001ece8e5 Mon Sep 17 00:00:00 2001 From: Matthew Johnston Date: Tue, 23 Mar 2021 07:39:39 -0500 Subject: [PATCH 6/6] The default branch is main --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6c3c534..3be65c5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - master + - main jobs: test: