diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..01108a4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI +on: + push: + branches: + - master + + pull_request: + branches: + - master + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Elixir and Erlang versions + uses: erlef/setup-beam@v1 + id: setup-elixir + with: + version-type: strict + version-file: .tool-versions + + - name: Restore the cache + uses: actions/cache@v3 + with: + path: | + deps + _build + dialyzer + key: | + ${{ runner.os }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ steps.setup-elixir.outputs.otp-version }}-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + restore-keys: | + ${{ runner.os }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ steps.setup-elixir.outputs.otp-version }}-mixlockhash- + + - name: Run CI + run: | + mix ci \ No newline at end of file diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..4bddf72 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +erlang 27.2 +elixir 1.18.0-otp-27 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ffca7a4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: elixir - -elixir: - - 1.5.1 - -script: - - mix test diff --git a/mix.exs b/mix.exs index e14afea..b13e112 100644 --- a/mix.exs +++ b/mix.exs @@ -1,16 +1,18 @@ defmodule Authex.Mixfile do use Mix.Project - @version "2.3.0" + @version "2.4.0" def project do [ app: :authex, version: @version, - elixir: "~> 1.5", + elixir: "~> 1.16", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), + aliases: aliases(), + preferred_cli_env: preferred_cli_env(), description: description(), package: package(), name: "Authex", @@ -42,6 +44,30 @@ defmodule Authex.Mixfile do ] end + # Aliases are shortcuts or tasks specific to the current project. + defp aliases do + [ + setup: [ + "local.hex --if-missing --force", + "local.rebar --if-missing --force", + "deps.get" + ], + ci: [ + "setup", + "compile --warnings-as-errors", + "format --check-formatted", + "test" + ] + ] + end + + # Specifies the preferred env for mix commands. + defp preferred_cli_env do + [ + ci: :test + ] + end + defp docs do [ main: "Authex",