From 638755a84c6dbe583fc876ce30f6d4096ff03554 Mon Sep 17 00:00:00 2001 From: Sam Hamilton Date: Wed, 10 Jul 2024 18:14:23 +0800 Subject: [PATCH] Bump elixir (#37) * bump elixir * Fix failing CI --------- Co-authored-by: dgross881 --- .github/workflows/tests.yml | 82 ++++++++++++++++++++++++++----------- .tool-versions | 11 +++++ lib/trailing_slash_plug.ex | 2 +- mix.exs | 2 +- 4 files changed, 70 insertions(+), 27 deletions(-) create mode 100644 .tool-versions diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5b34d62..206f62a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,31 +10,63 @@ jobs: tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: erlef/setup-beam@v1 - with: - otp-version: "26.x" - elixir-version: "1.15.x" - - uses: actions/cache@v4 - with: - path: | - deps - _build - key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix- - - run: mix deps.get - - run: mix compile --warnings-as-errors - - run: mix deps.unlock --check-unused - - run: mix hex.audit - # -run: mix doctor - - run: mix format --dry-run --check-formatted - - run: mix sobelow --config - - run: mix format --dry-run --check-formatted - - run: mix credo --strict - - run: mix dialyzer - - run: elixir --logger-sasl-reports true -S mix coveralls.json - - uses: codecov/codecov-action@v4 + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + otp-version: "27.x" + elixir-version: "1.17.x" + - uses: actions/cache@v4 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix- + - run: mix deps.get + - run: mix compile --warnings-as-errors + - run: mix deps.unlock --check-unused + - run: mix hex.audit + # -run: mix doctor + - run: mix format --dry-run --check-formatted + - run: mix sobelow --config + - run: mix format --dry-run --check-formatted + - run: mix credo --strict + - run: mix dialyzer + - run: elixir --logger-sasl-reports true -S mix coveralls.json + - uses: codecov/codecov-action@v4 + + elixir_1_17: + runs-on: ubuntu-latest + name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} + strategy: + matrix: + otp: [25.x, 26.x, 27.x] + elixir: [1.17.x] + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + - run: mix do deps.get, compile --all-warnings --warnings-as-errors + - run: mix test + + elixir_1_16: + runs-on: ubuntu-latest + name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} + strategy: + matrix: + otp: [24.x, 25.x, 26.x] + elixir: [1.16.x] + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + - run: mix do deps.get, compile --all-warnings --warnings-as-errors + - run: mix test elixir_1_15: runs-on: ubuntu-latest diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..f36fa50 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,11 @@ +# https://github.com/elixir-lang/elixir/releases + +elixir 1.17.2-otp-27 + +# https://github.com/erlang/otp/releases + +erlang 27.0 + +# https://nodejs.org/en + +nodejs 20.11.1 diff --git a/lib/trailing_slash_plug.ex b/lib/trailing_slash_plug.ex index 79da1a2..ffd2368 100644 --- a/lib/trailing_slash_plug.ex +++ b/lib/trailing_slash_plug.ex @@ -26,7 +26,7 @@ defmodule TrailingSlashPlug do path = conn.request_path if String.ends_with?(path, "/") && path != "/" do - new_path = String.slice(path, 0..-2) + new_path = String.slice(path, 0..-2//-1) conn |> put_status(301) diff --git a/mix.exs b/mix.exs index bc2060a..2558663 100644 --- a/mix.exs +++ b/mix.exs @@ -35,7 +35,7 @@ defmodule TrailingSlashPlug.MixProject do [ {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}, {:excoveralls, "~> 0.15", only: :test}, - {:plug, "~> 1.14"}, + {:plug, "~> 1.16"}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false}, {:sobelow, "~> 0.11", only: [:dev, :test], runtime: false}