From bba72dbb5b4c700ed61ce4649a1f13948f009bc1 Mon Sep 17 00:00:00 2001 From: Bryan Joseph Date: Thu, 13 Jun 2024 12:13:31 -0500 Subject: [PATCH] Check absinthe dependent libraries on CI runs * Update elixir versions in CI to test 1.15, 1.16, and 1.17 * Update OTP version in CI to test 25, 26, and 27 * Update ubuntu version to 24.04 * Lower jaro_distance threshold slightly * Remove else part of with expression in generate_schema. Dialyzer saw that Absinthe.Schema.introspect will only return {:error, String.t()} if there is an error --- .github/workflows/check_dependents.yml | 52 ++++++++++++++++++++++++++ .github/workflows/elixir.yml | 36 ++++++++---------- lib/absinthe/utils/suggestion.ex | 2 +- lib/mix/tasks/absinthe.schema.json.ex | 3 -- 4 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/check_dependents.yml diff --git a/.github/workflows/check_dependents.yml b/.github/workflows/check_dependents.yml new file mode 100644 index 0000000000..d808496f72 --- /dev/null +++ b/.github/workflows/check_dependents.yml @@ -0,0 +1,52 @@ +name: Check Dependents + +on: + push: + pull_request: + branches: + - master + +jobs: + test_dependents: + name: Ensure ${{ matrix.dependent }} tests pass + runs-on: ubuntu-24.04 + + strategy: + matrix: + dependent: + - 'absinthe_plug' + - 'absinthe_phoenix' + - 'absinthe_relay' + + steps: + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: '1.17' + otp-version: '27' + + - name: Checkout absinthe + uses: actions/checkout@v4 + + - name: Checkout ${{ matrix.dependent }} + uses: actions/checkout@v4 + with: + repository: 'absinthe-graphql/${{ matrix.dependent }}' + path: '${{ matrix.dependent }}' + + - name: Install absinthe package dependencies + run: mix deps.get + + - name: Update absinthe dependency + run: 'sed -i -e "s|{:absinthe,.*|{:absinthe, path: \"$GITHUB_WORKSPACE\", override: true},|" mix.exs' + working-directory: ./${{ matrix.dependent }} + + - name: Install ${{ matrix.dependent }} package dependencies + run: mix deps.get + working-directory: ./${{ matrix.dependent }} + + - name: Run unit tests + run: | + mix clean + mix test + working-directory: ./${{ matrix.dependent }} diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index b4e2c7dfb1..ff36fb7b2c 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -9,27 +9,25 @@ on: jobs: test: name: Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 strategy: matrix: elixir: - - "1.13" - - "1.14" - - "1.15" + - '1.15' + - '1.16' + - '1.17' otp: - - "24" - - "25" - - "26" - include: - - elixir: "1.15" - otp: "26" - format: true + - '25' + - '26' + - '27' exclude: - - otp: 26 - elixir: 1.13 - - otp: 26 - elixir: 1.14 + - otp: 25 + elixir: 1.17 + - otp: 27 + elixir: 1.15 + - otp: 27 + elixir: 1.16 steps: - name: Checkout @@ -57,7 +55,6 @@ jobs: - name: Check Formatting run: mix format --check-formatted - if: ${{ matrix.format }} - name: Run unit tests run: | @@ -77,10 +74,9 @@ jobs: path: | priv/plts key: "v1-${{ runner.os }}-\ - erlang-${{ matrix.otp }}-\ - elixir-${{ matrix.elixir }}-\ - ${{ hashFiles('mix.lock') }}" + erlang-${{ matrix.otp }}-\ + elixir-${{ matrix.elixir }}-\ + ${{ hashFiles('mix.lock') }}" - name: Run Dialyzer run: mix dialyzer - diff --git a/lib/absinthe/utils/suggestion.ex b/lib/absinthe/utils/suggestion.ex index 6c8d08cf7c..77140ee22c 100644 --- a/lib/absinthe/utils/suggestion.ex +++ b/lib/absinthe/utils/suggestion.ex @@ -1,5 +1,5 @@ defmodule Absinthe.Utils.Suggestion do - @jaro_threshold 0.70 + @jaro_threshold 0.68 @doc """ Sort a list of suggestions by Jaro distance to a target string, diff --git a/lib/mix/tasks/absinthe.schema.json.ex b/lib/mix/tasks/absinthe.schema.json.ex index 4db569c175..450e247cfe 100644 --- a/lib/mix/tasks/absinthe.schema.json.ex +++ b/lib/mix/tasks/absinthe.schema.json.ex @@ -101,9 +101,6 @@ defmodule Mix.Tasks.Absinthe.Schema.Json do with {:ok, result} <- Absinthe.Schema.introspect(schema) do content = json_codec.encode!(result, pretty: pretty) {:ok, content} - else - {:error, reason} -> {:error, reason} - error -> {:error, error} end end