Created
November 24, 2021 21:35
-
-
Save georgiybykov/603cf8d4bfa250f4062beaba7a263783 to your computer and use it in GitHub Desktop.
GitHub Actions for Elixir
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: | |
all_jobs: | |
runs-on: ubuntu-latest | |
env: | |
MIX_ENV: test | |
strategy: | |
matrix: | |
elixir: ['1.12'] | |
otp: ['24'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set mix file hash | |
id: set_vars | |
run: | | |
mix_hash="${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}" | |
echo "::set-output name=mix_hash::$mix_hash" | |
- name: Cache PLT files | |
id: cache-plt | |
uses: actions/cache@v2 | |
with: | |
path: | | |
_build/dev/*.plt | |
_build/dev/*.plt.hash | |
key: plt-cache-${{ steps.set_vars.outputs.mix_hash }} | |
restore-keys: | | |
plt-cache- | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.elixir }} | |
otp-version: ${{ matrix.otp }} | |
- name: Get deps cache | |
uses: actions/cache@v2 | |
with: | |
path: deps/ | |
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
- name: Get build cache | |
uses: actions/cache@v2 | |
with: | |
path: _build/test/ | |
key: build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
- name: Install Dependencies | |
run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
mix deps.compile | |
mix compile | |
- name: Run Linter | |
run: mix credo --strict | |
- name: Run Dialyzer for type checking | |
run: mix dialyzer --format dialyzer | |
- name: Run Tests | |
run: mix coveralls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment