浏览代码

Include Go version to cache key in CI

DarthSim 2 年之前
父节点
当前提交
127015bf75
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 2
      .github/workflows/lint.yml
  2. 1 1
      .github/workflows/test.yml

+ 2 - 2
.github/workflows/lint.yml

@@ -25,10 +25,10 @@ jobs:
       - name: Cache mods
       - name: Cache mods
         uses: actions/cache@v3
         uses: actions/cache@v3
         with:
         with:
-          path:  |
+          path: |
             ~/.cache/go-build
             ~/.cache/go-build
             ~/go/pkg/mod
             ~/go/pkg/mod
-          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+          key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
       - name: Download mods
       - name: Download mods
         run: go mod download
         run: go mod download
       - name: Lint
       - name: Lint

+ 1 - 1
.github/workflows/test.yml

@@ -28,7 +28,7 @@ jobs:
           path: |
           path: |
             ~/.cache/go-build
             ~/.cache/go-build
             ~/go/pkg/mod
             ~/go/pkg/mod
-          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+          key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
       - name: Download mods
       - name: Download mods
         run: go mod download
         run: go mod download
       - name: Test
       - name: Test