Created
November 24, 2021 21:37
-
-
Save georgiybykov/069dcb8718d89a1151b9eea302b9a8df to your computer and use it in GitHub Desktop.
GitHub Actions for Elixir (extended version with shared dependencies)
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
# .github/workflows/elixir.yml | |
--- | |
name: build | |
on: [push, pull_request] | |
jobs: | |
dependencies: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
elixir: ['1.12'] | |
otp: ['24'] | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout Github repo | |
uses: actions/checkout@v2 | |
- name: Sets up an Erlang/OTP environment | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.elixir }} | |
otp-version: ${{ matrix.otp }} | |
- name: Retrieve cached dependencies | |
uses: actions/cache@v2 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
priv/plts | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} | |
- name: Install dependencies | |
if: steps.mix-cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p priv/plts | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
mix deps.compile | |
mix compile | |
mix dialyzer --plt | |
static-code-analysis: | |
needs: dependencies | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
elixir: ['1.12'] | |
otp: ['24'] | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout Github repo | |
uses: actions/checkout@v2 | |
- name: Sets up an Erlang/OTP environment | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.elixir }} | |
otp-version: ${{ matrix.otp }} | |
- name: Retrieve cached dependencies | |
uses: actions/cache@v2 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
priv/plts | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} | |
- run: mix format --check-formatted | |
- run: mix credo --strict | |
- run: mix dialyzer --no-check --ignore-exit-status | |
tests: | |
runs-on: ubuntu-latest | |
needs: dependencies | |
strategy: | |
matrix: | |
elixir: ['1.12'] | |
otp: ['24'] | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout Github repo | |
uses: actions/checkout@v2 | |
- name: Sets up an Erlang/OTP environment | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.elixir }} | |
otp-version: ${{ matrix.otp }} | |
- name: Retrieve cached dependencies | |
uses: actions/cache@v2 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
priv/plts | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} | |
# - run: mix test --trace --slowest 10 | |
- run: mix coveralls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment