diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a00a481..88d032f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,8 +8,7 @@ on: jobs: test: - name: Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}} - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 services: postgres: @@ -21,23 +20,26 @@ jobs: POSTGRES_PASSWORD: postgres strategy: + fail-fast: false matrix: - elixir: - - '1.13' - - '1.14' - otp: - - '24' - - '25' + include: + - pair: + elixir: 1.11.4 + otp: 22.3 + - pair: + elixir: 1.15.7 + otp: 26.1 + lint: lint steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Elixir uses: erlef/setup-beam@v1 with: - elixir-version: ${{ matrix.elixir }} - otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.pair.elixir }} + otp-version: ${{ matrix.pair.otp }} - name: Restore deps cache uses: actions/cache@v3 @@ -45,10 +47,10 @@ jobs: path: | deps _build - key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }} + key: deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }} restore-keys: | - deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} - deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} + deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }} + deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }} - name: Create dializer plts path run: mkdir -p priv/plts @@ -57,21 +59,32 @@ jobs: uses: actions/cache@v3 with: path: priv/plts - key: plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }} + key: plts-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }} restore-keys: | - plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} - plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} + plts-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }} + plts-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }} - name: Install package dependencies run: mix deps.get - name: Check code format run: mix format --check-formatted + if: ${{ matrix.lint }} + + - name: Check unused deps + run: mix deps.unlock --check-unused + if: ${{ matrix.lint }} - name: Compile dependencies - run: mix compile + run: mix deps.compile + env: + MIX_ENV: test + + - name: Compile app + run: mix compile --warnings-as-errors env: MIX_ENV: test + if: ${{ matrix.lint }} - name: Run unit tests run: | @@ -82,3 +95,4 @@ jobs: - name: Run dialyzer run: mix dialyzer + if: ${{ matrix.lint }} diff --git a/.tool-versions b/.tool-versions index ffcdf14..510eaf4 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -elixir 1.14.1-otp-24 1.12.0-otp-24 -erlang 24.1.7 24.1.5 24.1.2 24.1.1 24.0 +elixir 1.15.7-otp-26 +erlang 26.1.2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3394e13..5473522 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ Make sure the tests pass. Running tests for Dataloader requires a running instance of Postgres. The easiest way to do this is to run Postgres inside of Docker whilst running the Dataloader tests. In one terminal run: - docker run -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=dataloader_test postgres + docker run -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=dataloader_test docker.io/postgres and in another terminal run: diff --git a/lib/dataloader.ex b/lib/dataloader.ex index 28a47c7..1082d15 100644 --- a/lib/dataloader.ex +++ b/lib/dataloader.ex @@ -394,13 +394,13 @@ defmodule Dataloader do # Optionally use `async/1` and `async_stream/3` functions from # `opentelemetry_process_propagator` if available if Code.ensure_loaded?(OpentelemetryProcessPropagator.Task) do - @spec async((() -> any)) :: Task.t() + @spec async((-> any)) :: Task.t() defdelegate async(fun), to: OpentelemetryProcessPropagator.Task @spec async_stream(Enumerable.t(), (term -> term), keyword) :: Enumerable.t() defdelegate async_stream(items, fun, opts), to: OpentelemetryProcessPropagator.Task else - @spec async((() -> any)) :: Task.t() + @spec async((-> any)) :: Task.t() defdelegate async(fun), to: Task @spec async_stream(Enumerable.t(), (term -> term), keyword) :: Enumerable.t() diff --git a/mix.exs b/mix.exs index b964f68..a34bc10 100644 --- a/mix.exs +++ b/mix.exs @@ -8,7 +8,7 @@ defmodule Dataloader.Mixfile do [ app: :dataloader, version: @version, - elixir: "~> 1.12", + elixir: "~> 1.11", start_permanent: Mix.env() == :prod, elixirc_paths: elixirc_paths(Mix.env()), package: package(), diff --git a/mix.lock b/mix.lock index 2c195ff..a0f6cec 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,4 @@ %{ - "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "db_connection": {:hex, :db_connection, "2.5.0", "bb6d4f30d35ded97b29fe80d8bd6f928a1912ca1ff110831edcd238a1973652c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c92d5ba26cd69ead1ff7582dbb860adeedfff39774105a4f1c92cbb654b55aa2"}, "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"}, "dialyxir": {:hex, :dialyxir, "1.3.0", "fd1672f0922b7648ff9ce7b1b26fcf0ef56dda964a459892ad15f6b4410b5284", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "00b2a4bcd6aa8db9dcb0b38c1225b7277dca9bc370b6438715667071a304696f"},