From 155aa70fb24c61200875396ab1303eec97a369b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sta=C5=84czak-Marikin?= Date: Mon, 3 Jun 2024 14:56:58 +0200 Subject: [PATCH] Add dialyzer --- .github/workflows/dialyzer.yml | 79 ++++++++++++++++++++++++++++++++++ .github/workflows/format.yml | 8 ++-- 2 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/dialyzer.yml diff --git a/.github/workflows/dialyzer.yml b/.github/workflows/dialyzer.yml new file mode 100644 index 000000000..dd48e3867 --- /dev/null +++ b/.github/workflows/dialyzer.yml @@ -0,0 +1,79 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Lint and style checks + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: + +# Sets the ENV `MIX_ENV` to `test` for running tests +env: + MIX_ENV: test + ELIXIR_VER: '1.16.2' + OTP_VER: '25.0.4' + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + name: Prepare environment + + steps: + # Step: Setup Elixir + Erlang image as the base. + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + otp-version: ${{ env.OTP_VER }} + elixir-version: ${{ env.ELIXIR_VER }} + + # Step: Check out the code. + - name: Checkout code + uses: actions/checkout@v4 + + # Step: Define how to cache deps. Restores existing cache if present. + - name: Cache deps + id: cache-deps + uses: actions/cache@v4 + env: + cache-name: cache-elixir-deps + with: + path: deps + key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix-${{ env.cache-name }}- + + # Step: Define how to cache the `_build` directory. After the first run, + # this speeds up tests runs a lot. This includes not re-compiling our + # project's downloaded deps every run. + - name: Cache compiled build + id: cache-build + uses: actions/cache@v4 + env: + cache-name: cache-compiled-build + with: + path: _build + key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix-${{ env.cache-name }}- + + # Step: Download project dependencies. If unchanged, uses + # the cached version. + - name: Install dependencies + run: mix deps.get + + # Step: Compile the current project. If unchanged, uses + # the cached version. + - name: Install dependencies + run: mix compile + + - name: mix dialyzer + run: mix dialyzer --format github diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 58d2ecfd6..190f5ac86 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -3,7 +3,7 @@ # separate terms of service, privacy policy, and support # documentation. -name: Lint (mix format) +name: Lint and style checks on: push: @@ -25,7 +25,7 @@ permissions: jobs: build: runs-on: ubuntu-latest - name: Mix format + name: Prepare environment steps: # Step: Setup Elixir + Erlang image as the base. @@ -75,7 +75,5 @@ jobs: - name: Install dependencies run: mix compile - # Step: Download project dependencies. If unchanged, uses - # the cached version. - - name: Lint + - name: mix format run: mix format --check-formatted