Skip to content

Commit

Permalink
Test on new elixir versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaden Wilkinson committed Feb 16, 2022
1 parent 102360e commit 335df82
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 44 deletions.
88 changes: 47 additions & 41 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,53 @@ jobs:
strategy:
matrix:
elixir:
- '1.10'
- '1.11'
- "1.10"
- "1.11"
- "1.12"
- "1.13"
otp:
- '22'
- '23'
- "22"
- "23"
- "24"
exclude:
- elixir: "1.10"
otp: "24"

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}

- name: Restore deps cache
uses: actions/cache@v2
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }}
restore-keys: |
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
- name: Install package dependencies
run: mix deps.get

- name: Check Formatting
run: mix format --check-formatted

- name: Run unit tests
run: |
mix clean
mix test
- name: Run unit tests with persistent_term backend
run: |
mix clean
mix test
env:
SCHEMA_PROVIDER: persistent_term
- name: Checkout
uses: actions/checkout@v2

- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}

- name: Restore deps cache
uses: actions/cache@v2
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }}
restore-keys: |
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
- name: Install package dependencies
run: mix deps.get

- name: Check Formatting
run: mix format --check-formatted

- name: Run unit tests
run: |
mix clean
mix test
- name: Run unit tests with persistent_term backend
run: |
mix clean
mix test
env:
SCHEMA_PROVIDER: persistent_term
4 changes: 3 additions & 1 deletion lib/absinthe/lexer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ defmodule Absinthe.Lexer do

defp block_string_value_token(rest, chars, context, _loc, _byte_offset) do
value = '"""' ++ (chars |> Enum.reverse()) ++ '"""'
{rest, [{:block_string_value, context.token_location, value}], Map.delete(context, :token_location)}

{rest, [{:block_string_value, context.token_location, value}],
Map.delete(context, :token_location)}
end

defp string_value_token(rest, chars, context, _loc, _byte_offset) do
Expand Down
7 changes: 7 additions & 0 deletions lib/absinthe/phase/schema/type_imports.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ defmodule Absinthe.Phase.Schema.TypeImports do
else
Code.ensure_compiled(module)
end
catch
# Code.ensure_compiled! in Elixir >1.12 raises an ArgumentError if it is unable to find the module with message similar to
# "could not load module <module> due to reason <reason>"
# where reason is an atom :embedded | :badfile | :nofile | :on_load_failure | :unavailable
_, %ArgumentError{message: message} ->
reason = message |> String.split(":") |> List.last()
{:error, reason}
end

# Generate an error when loading module fails
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"makeup_graphql": {:hex, :makeup_graphql, "0.1.2", "81e2939aab6d2b81d39ee5d9e13fae02599e9ca6e1152e0eeed737a98a5f96aa", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "3390ab04ba388d52a94bbe64ef62aa4d7923ceaffac43ec948f58f631440e8fb"},
"mix_test_watch": {:hex, :mix_test_watch, "1.0.2", "34900184cbbbc6b6ed616ed3a8ea9b791f9fd2088419352a6d3200525637f785", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "47ac558d8b06f684773972c6d04fcc15590abdb97aeb7666da19fcbfdc441a07"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.2", "811e32fb77aabb2b5b6196b21f76fe6ba8b6861c3d8c9eaeedbbf1f4cda627d1", [:mix], [], "hexpm", "dd3504559b0ddfeb7f55297557313fc05340120a037f981a4775b1c43e61d1b9"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.2", "b99ca56bbce410e9d5ee4f9155a212e942e224e259c7ebbf8f2c86ac21d4fa3c", [:mix], [], "hexpm", "98d51bd64d5f6a2a9c6bb7586ee8129e27dfaab1140b5a4753f24dac0ba27d2f"},
"telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},
}
2 changes: 1 addition & 1 deletion test/absinthe/phase/parse_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ defmodule Absinthe.Phase.ParseTest do
assert [
%Absinthe.Phase.Error{
extra: %{},
locations: [%{column: 0, line: 4}],
locations: [%{column: 3, line: 4}],
message: "syntax error before: ",
phase: Absinthe.Phase.Parse
}
Expand Down

0 comments on commit 335df82

Please sign in to comment.