From c0b78f5067c5ebff7bafb1082c3efcf7f44f6b0a Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Tue, 14 Nov 2023 12:58:28 +0800 Subject: [PATCH] Support OTP 26.x and Elixir 1.15.x in GitHub CI List of changes: - bump apps version in GitHub CI - add additional jobs for more checking - use default job name - cache deps - remove unused dep --- .github/workflows/test.yml | 68 ++++++++++++++++++++++++++++++-------- mix.exs | 2 +- mix.lock | 1 - 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90a4a95..26f4bfc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,24 +1,64 @@ -on: push +name: test -name: - test +on: + push: + pull_request: + branches: + - master jobs: test: - runs-on: ubuntu-latest - name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} + runs-on: ubuntu-20.04 env: MIX_ENV: test strategy: matrix: - otp: ['21.0', '23.0'] - elixir: ['1.7', '1.11'] + include: + - pair: + elixir: 1.11.4 + otp: 22.3 + - pair: + elixir: 1.15.7 + otp: 26.1 + lint: lint steps: - - uses: actions/checkout@v2 - - uses: erlef/setup-elixir@v1 + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.pair.otp}} + elixir-version: ${{matrix.pair.elixir}} + + - name: Restore deps cache + uses: actions/cache@v3 with: - otp-version: ${{matrix.otp}} - elixir-version: ${{matrix.elixir}} - - run: mix deps.get - - run: mix compile --warnings-as-errors - - run: mix test + path: | + deps + _build + key: deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }} + restore-keys: | + deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }} + deps-${{ 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 deps.compile + + - name: Compile app + run: mix compile --warnings-as-errors + if: ${{ matrix.lint }} + + - name: Run test + run: mix test diff --git a/mix.exs b/mix.exs index 656b8f8..4aa5f2e 100644 --- a/mix.exs +++ b/mix.exs @@ -8,7 +8,7 @@ defmodule Decorator.Mixfile do [ app: :decorator, version: @version, - elixir: "~> 1.5", + elixir: "~> 1.11", elixirc_options: elixirrc_options(Mix.env()), build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, diff --git a/mix.lock b/mix.lock index 3e96586..6825226 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,4 @@ %{ - "earmark": {:hex, :earmark, "1.3.1", "73812f447f7a42358d3ba79283cfa3075a7580a3a2ed457616d6517ac3738cb9", [:mix], [], "hexpm"}, "earmark_parser": {:hex, :earmark_parser, "1.4.12", "b245e875ec0a311a342320da0551da407d9d2b65d98f7a9597ae078615af3449", [:mix], [], "hexpm", "711e2cc4d64abb7d566d43f54b78f7dc129308a63bc103fbd88550d2174b3160"}, "ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"}, "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},