Fork me on GitHub
#leiningen
<
2022-03-16
>
zendevil.eth13:03:17

Does anyone know how to https://github.com/actions/cache`lein deps` in github workflows? I have the following as my github workflow, but I’m getting cache not found in github actions:

name: Run Tests
on:
  push:
jobs:
  test:
    runs-on: ${{ matrix.os }}
    name: Node ${{ matrix.node }} | OS ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-18.04]
        node: [12.x]
    steps:
      - uses: actions/[email protected]
      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node }}
      - name: Cache Deps
        id: cache-deps
        uses: actions/cache@v1
        with:
          path: /root/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }}
      - name: Runs Elasticsearch
        uses: elastic/elastic-github-actions/elasticsearch@master
        with:
          stack-version: 7.6.0
      - name: Install dependencies
        run: lein deps
        if: steps.cache-deps.outputs.cache-hit != 'true'
This is what I get in subsequent deployments:
Run actions/cache@v1
  with:
    path: /root/.m2/repository
    key: Linux-maven-5360f82c800957116727d834bd0b32bcbfce17a5c94f606864cfae4990bf344f
Cache not found for input keys: Linux-maven-5360f82c800957116727d834bd0b32bcbfce17a5c94f606864cfae4990bf344f.

Leaf Garland22:03:16

Your cache step is much the same as ours, but we have ~/.m2/repository for the path. Don't know if that makes any difference. Have you checked your action logs to see that it is populating the cache?

zendevil.eth15:03:18

I don’t know what logs to look at, but I do see a “Post Cache Deps” with:

Post job cleanup.
Warning: Cache already exists. Scope: refs/heads/prit/cache-lein-deps, Key: Linux-maven-5360f82c800957116727d834bd0b32bcbfce17a5c94f606864cfae4990bf344f, Version: (null)

zendevil.eth16:03:10

changing to ~/ worked