From 12421714055cfc45ab4028b5b012ebf0c09b3bfb Mon Sep 17 00:00:00 2001 From: Jean Parpaillon Date: Thu, 4 Apr 2024 19:36:16 +0200 Subject: [PATCH] Add github CI workflow --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3ff7523 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: Elixir CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-22.04 + env: + MIX_ENV: test + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-elixir@v1 + with: + elixir-version: '1.16.2-otp-26' + otp-version: '26.2.3' + - uses: actions/cache@v4 + id: mix-cache + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - if: steps.mix-cache.outputs.cache-hit != 'true' + run: mix deps.get + - run: mix test + + lint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + elixir-version: '1.16.2-otp-26' + otp-version: '26.2.3' + - uses: erlef/setup-elixir@v1 + with: + elixir-version: '1.16.2-otp-26' + otp-version: '26.2.3' + - uses: actions/cache@v4 + id: mix-cache + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - if: steps.mix-cache.outputs.cache-hit != 'true' + run: mix deps.get + - run: mix format --check-formatted + - run: mix credo --strict + - uses: actions/cache@v4 + id: plt-cache + with: + path: priv/plts + key: ${{ runner.os }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - if: steps.plt-cache.outputs.cache-hit != 'true' + run: | + mkdir -p priv/plts + mix dialyzer --plt + - run: mix dialyzer --no-check --halt-exit-status