Apply minor refactoring (#122) #241
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# See more: | |
# https://hashrocket.com/blog/posts/build-the-ultimate-elixir-ci-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
internal_dialyzer: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 30 | |
name: Internal Typespecs | |
env: | |
OTP: "25.3" | |
ELIXIR: "1.13" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ env.OTP }} | |
elixir-version: ${{ env.ELIXIR }} | |
- uses: actions/cache@v2 | |
id: mix-cache | |
with: | |
path: deps | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- uses: actions/cache@v2 | |
id: build-cache | |
with: | |
path: _build | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- uses: actions/cache@v1 | |
id: plt-cache | |
with: | |
path: priv/plts | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
- if: steps.plt-cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p priv/plts | |
mix dialyzer --plt | |
- run: mix dialyzer --force-check | |
credo: | |
runs-on: ubuntu-20.04 | |
name: Code Style | |
env: | |
OTP: "25.3" | |
ELIXIR: "1.13" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ env.OTP }} | |
elixir-version: ${{ env.ELIXIR }} | |
- uses: actions/cache@v2 | |
id: mix-cache | |
with: | |
path: deps | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- uses: actions/cache@v2 | |
id: build-cache | |
with: | |
path: _build | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
- run: mix credo | |
formatter: | |
runs-on: ubuntu-20.04 | |
name: Code Formatting | |
env: | |
OTP: "25.3" | |
ELIXIR: "1.13" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ env.OTP }} | |
elixir-version: ${{ env.ELIXIR }} | |
- uses: actions/cache@v2 | |
id: mix-cache | |
with: | |
path: deps | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- uses: actions/cache@v2 | |
id: build-cache | |
with: | |
path: _build | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
- run: mix format --check-formatted | |
external_dialyzer: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 30 | |
name: External Typespecs | |
env: | |
OTP: "25.3" | |
ELIXIR: "1.13" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ env.OTP }} | |
elixir-version: ${{ env.ELIXIR }} | |
- uses: actions/cache@v2 | |
id: mix-cache | |
with: | |
path: test/integration/deps | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-mix-ext-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- uses: actions/cache@v2 | |
id: build-cache | |
with: | |
path: test/integration/_build | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-build-ext-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- uses: actions/cache@v1 | |
id: plt-cache | |
with: | |
path: test/integration/priv/plts | |
key: ${{ runner.os }}-${{ env.OTP }}-${{ env.ELIXIR }}-plts-ext-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- working-directory: test/integration | |
run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
- if: steps.plt-cache.outputs.cache-hit != 'true' | |
working-directory: test/integration | |
run: | | |
mkdir -p priv/plts | |
mix dialyzer --plt | |
- working-directory: test/integration | |
run: mix dialyzer --force-check | |
test: | |
runs-on: ubuntu-20.04 | |
name: OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }} | |
strategy: | |
fail-fast: true | |
# NOTE: We are going to support 4 version from the official list of 5 | |
# https://hexdocs.pm/elixir/compatibility-and-deprecations.html | |
matrix: | |
otp: ["25.3"] | |
elixir: ["1.13.4"] | |
include: | |
- otp: "26.2" | |
elixir: "1.14.5" | |
- otp: "26.2" | |
elixir: "1.15.8" | |
- otp: "26.2" | |
elixir: "1.16.3" | |
- otp: "27.0" | |
elixir: "1.17.1" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- uses: actions/cache@v2 | |
id: mix-cache | |
with: | |
path: deps | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- uses: actions/cache@v2 | |
id: build-cache | |
with: | |
path: _build | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
- run: mix test |