From e801d87e89230eadbe299ab0394be30611923fba Mon Sep 17 00:00:00 2001 From: dolfinus Date: Sun, 21 Mar 2021 00:18:29 +0300 Subject: [PATCH] Improve Github Actions --- .formatter.exs | 4 ++-- .github/workflows/test.yml | 40 ++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.formatter.exs b/.formatter.exs index 89ceccb..3975932 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,4 +1,4 @@ [ - inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"], - import_deps: [:absinthe], + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"], + import_deps: [:absinthe] ] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25a7811..563399f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,8 +2,6 @@ name: CI on: push: - branches: - - master pull_request: branches: - master @@ -15,11 +13,12 @@ jobs: strategy: matrix: - include: - - elixir: '1.11' - otp: '23' - - elixir: '1.10' - otp: '22' + elixir: + - '1.10' + - '1.11' + otp: + - '22' + - '23' steps: - name: Checkout @@ -34,21 +33,24 @@ jobs: - name: Restore deps cache uses: actions/cache@v2 with: - path: deps - key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }} - - - name: Restore _build cache - uses: actions/cache@v2 - with: - path: _build - key: ${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} + path: | + deps + _build + key: ${{ runner.os }}-deps-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }} restore-keys: | - ${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }} + ${{ runner.os }}-deps-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} + ${{ runner.os }}-deps-${{ matrix.otp }}-${{ matrix.elixir }} - - name: Install Dependencies + - name: Install package dependencies run: mix deps.get + - name: Check code format + run: mix format --check-formatted + + - name: Compile dependencies + run: mix compile + env: + MIX_ENV: test + - name: Run unit tests run: mix test