From f7dddd2380ea798ee824b8bfce44f2e23da14a39 Mon Sep 17 00:00:00 2001 From: Zoey de Souza Pessanha Date: Sat, 18 Nov 2023 19:14:27 -0300 Subject: [PATCH] config: add cache to CI --- .github/workflows/deps.yml | 8 ++++++++ .github/workflows/lint.yml | 23 +++++++++++++++++++---- .github/workflows/release.yml | 5 ++++- .github/workflows/test.yml | 17 +++++++++++++---- 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deps.yml b/.github/workflows/deps.yml index 4dc042a..0b37c70 100644 --- a/.github/workflows/deps.yml +++ b/.github/workflows/deps.yml @@ -28,3 +28,11 @@ jobs: mix local.hex --force mix deps.get mix deps.compile + - id: mix-deps + uses: actions/cache/save@v3 + with: + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: mix-deps + path: | + deps + _build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6fd8a9f..6349eba 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,18 +4,27 @@ on: push: branches: [main] pull_request: - workflow_run: - workflows: [deps] - types: - - completed env: MIX_ENV: test jobs: + deps: + name: Restore Cached deps + run-ons: ubuntu-latest + steps: + - id: mix-deps-restore + uses: actions/cache/restore@v3 + with: + key: mix-deps + path: | + _build + deps compile: name: Check compile warning run-ons: ubuntu-latest + needs: + - deps strategy: matrix: elixir: [1.15.7] @@ -32,6 +41,8 @@ jobs: format: name: Code format run-ons: ubuntu-latest + needs: + - deps strategy: matrix: elixir: [1.15.7] @@ -48,6 +59,8 @@ jobs: credo: name: Static Code Analysis run-ons: ubuntu-latest + needs: + - deps strategy: matrix: elixir: [1.15.7] @@ -64,6 +77,8 @@ jobs: dialyzer: name: Dialyzer run-ons: ubuntu-latest + needs: + - deps strategy: matrix: elixir: [1.15.7] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ddd2cd5..4c51cee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,10 +5,13 @@ on: tags: - '*' workflow_run: - workflows: [deps lint test] + workflows: [test] types: - completed +env: + MIX_ENV: prod + jobs: publish: runs-ons: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3789800..c26dead 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,18 +4,27 @@ on: push: branches: [main] pull_request: - workflow_run: - workflows: [deps lint] - types: - - completed env: MIX_ENV: test jobs: + deps: + name: Restore Cached deps + run-ons: ubuntu-latest + steps: + - id: mix-deps-restore + uses: actions/cache/restore@v3 + with: + key: mix-deps + path: | + _build + deps test: name: Run tests runs-on: ubuntu-latest + needs: + - deps needs: - deps - lint