Skip to content

Commit

Permalink
config: add cache to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedsoupe committed Nov 18, 2023
1 parent 7100831 commit f7dddd2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 19 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -32,6 +41,8 @@ jobs:
format:
name: Code format
run-ons: ubuntu-latest
needs:
- deps
strategy:
matrix:
elixir: [1.15.7]
Expand All @@ -48,6 +59,8 @@ jobs:
credo:
name: Static Code Analysis
run-ons: ubuntu-latest
needs:
- deps
strategy:
matrix:
elixir: [1.15.7]
Expand All @@ -64,6 +77,8 @@ jobs:
dialyzer:
name: Dialyzer
run-ons: ubuntu-latest
needs:
- deps
strategy:
matrix:
elixir: [1.15.7]
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f7dddd2

Please sign in to comment.