From b1186b2f3e7bc24cff592fff743b19476c65b870 Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Mon, 15 Jul 2024 11:53:04 -0400 Subject: [PATCH] chore: Fix build warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although we are not building anything new with `gen_queue`, it is still worth fixing some minor issues. 1. Switch from Travis to GHA. 2. Change `@since …` attributes to `@doc since: …`. 3. Run `mix format`. 4. Make Elixir 1.15 the minimum version supported. 5. Fix a badly named test file. --- .github/dependabot.yml | 26 ++++++++ .github/workflows/elixir.yml | 63 ++++++++++++++++++++ .travis.yml | 7 --- lib/gen_queue.ex | 4 +- lib/gen_queue/job.ex | 2 +- mix.exs | 4 +- mix.lock | 9 ++- test/gen_queue/{job_test.ex => job_test.exs} | 1 - 8 files changed, 101 insertions(+), 15 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/elixir.yml delete mode 100644 .travis.yml rename test/gen_queue/{job_test.ex => job_test.exs} (99%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ad865f8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,26 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + groups: + actions-minor: + update-types: + - minor + - patch + + - package-ecosystem: mix + directory: / + schedule: + interval: monthly + groups: + elixir-development: + dependency-type: development + update-types: + - minor + - patch + elixir-production: + dependency-type: production + update-types: + - patch diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml new file mode 100644 index 0000000..e1344fc --- /dev/null +++ b/.github/workflows/elixir.yml @@ -0,0 +1,63 @@ +name: Elixir CI + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + elixir-ci: + name: Elixir ${{ matrix.elixir }} (OTP ${{ matrix.otp }}) + + env: + LANG: en_US.UTF-8 + LC_CTYPE: en_US.UTF-8 + + strategy: + fail-fast: true + matrix: + include: + - elixir: '1.15' + otp: '26' + os: ubuntu-22.04 + check_formatted: true + warnings_as_errors: true + - elixir: '1.16' + otp: '26' + os: ubuntu-22.04 + - elixir: '1.17' + otp: '27' + os: ubuntu-22.04 + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - uses: erlef/setup-elixir@v1 + id: install + with: + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} + + - uses: actions/cache@v4 + with: + key: builds@elixir-${{ steps.install.outputs.elixir-version }}-otp-${{ steps.install.outputs.otp-version }}-mix-${{ hashFiles('mix.lock') }} + path: | + deps + _build + + - run: mix 'do' deps.get, deps.compile + + - run: mix format --check-formatted + if: matrix.check_formatted + + - run: mix compile --warnings-as-errors + if: matrix.warnings_as_errors + + - run: mix compile + if: ${{ !matrix.warnings_as_errors }} + + - run: mix test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cd18a5d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: elixir - -elixir: - - 1.6.0 - -script: -- mix test diff --git a/lib/gen_queue.ex b/lib/gen_queue.ex index ce4cf5f..3f596a9 100644 --- a/lib/gen_queue.ex +++ b/lib/gen_queue.ex @@ -257,7 +257,7 @@ defmodule GenQueue do GenQueue.adapter(MyQueue, [otp_app: :my_app]) """ - @since "0.1.7" + @doc since: "0.1.7" @spec adapter(GenQueue.t(), opts :: Keyword.t()) :: GenQueue.Adapter.t() def adapter(gen_queue, opts \\ []) @@ -289,7 +289,7 @@ defmodule GenQueue do # Returns the provided options GenQueue.config(MyQueue, [adapter: MyAdapter]) """ - @since "0.1.7" + @doc since: "0.1.7" @spec config(GenQueue.t(), opts :: Keyword.t()) :: GenQueue.Adapter.t() def config(gen_queue, opts \\ []) diff --git a/lib/gen_queue/job.ex b/lib/gen_queue/job.ex index de1d8cb..e5a2cb5 100644 --- a/lib/gen_queue/job.ex +++ b/lib/gen_queue/job.ex @@ -51,7 +51,7 @@ defmodule GenQueue.Job do @spec new(module, list, options) :: GenQueue.Job.t() def new(module, args, opts) when is_list(args) do - job = Keyword.merge(opts, [module: module, args: args]) + job = Keyword.merge(opts, module: module, args: args) struct(__MODULE__, job) end end diff --git a/mix.exs b/mix.exs index 9c8a994..abe2c36 100644 --- a/mix.exs +++ b/mix.exs @@ -1,13 +1,13 @@ defmodule GenQueue.Mixfile do use Mix.Project - @version "0.1.8" + @version "0.2.0" def project do [ app: :gen_queue, version: @version, - elixir: "~> 1.6", + elixir: "~> 1.15", start_permanent: Mix.env() == :prod, deps: deps(), description: description(), diff --git a/mix.lock b/mix.lock index c7889ca..6110b13 100644 --- a/mix.lock +++ b/mix.lock @@ -1,4 +1,9 @@ %{ - "earmark": {:hex, :earmark, "1.2.5", "4d21980d5d2862a2e13ec3c49ad9ad783ffc7ca5769cf6ff891a4553fbaae761", [:mix], [], "hexpm"}, - "ex_doc": {:hex, :ex_doc, "0.18.3", "f4b0e4a2ec6f333dccf761838a4b253d75e11f714b85ae271c9ae361367897b7", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}, + "earmark": {:hex, :earmark, "1.2.5", "4d21980d5d2862a2e13ec3c49ad9ad783ffc7ca5769cf6ff891a4553fbaae761", [:mix], [], "hexpm", "c57508ddad47dfb8038ca6de1e616e66e9b87313220ac5d9817bc4a4dc2257b9"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"}, + "ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"}, + "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, } diff --git a/test/gen_queue/job_test.ex b/test/gen_queue/job_test.exs similarity index 99% rename from test/gen_queue/job_test.ex rename to test/gen_queue/job_test.exs index 0600208..5019e55 100644 --- a/test/gen_queue/job_test.ex +++ b/test/gen_queue/job_test.exs @@ -14,4 +14,3 @@ defmodule GenQueue.JobTest do end end end -