Skip to content

Commit

Permalink
chore: changed tests workflow to use cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Rekkice committed Jan 13, 2025
1 parent 27ac286 commit dfda8f5
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,46 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v26
- uses: nixbuild/nix-quick-install-action@v29

- uses: cachix/cachix-action@v14
with:
name: devenv
- uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Install devenv.sh
run: nix profile install nixpkgs#devenv

- name: Cache deps
id: cache-deps
uses: actions/cache@v4
env:
cache-name: cache-elixir-deps
with:
path: tololo/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: tololo/_build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
# Step: Conditionally bust the cache when job is re-run.
- name: Clean to rule out incremental build as a source of flakiness
if: github.run_attempt != '1'
run: |
mix deps.clean --all
mix clean
shell: sh

- name: Build the devenv shell and run tests
run: devenv test

0 comments on commit dfda8f5

Please sign in to comment.