From f8c685e7174290ef5c0697bb763390b697a01fea Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Thu, 23 Dec 2021 00:46:14 +0100 Subject: [PATCH] enable caching in workflows --- .github/workflows/build_test.yml | 14 +++++++++++++- .github/workflows/test.yml | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 31559b1f..ec565ac9 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -13,6 +13,18 @@ jobs: go-version: ${{ matrix.go-version }} - name: Checkout code uses: actions/checkout@v2 + - id: cache-paths + run: | + echo "::set-output name=cache::$(go env GOCACHE)" + echo "::set-output name=mod-cache::$(go env GOMODCACHE)" + - name: Cache go modules + uses: actions/cache@v2 + with: + path: | + ${{ steps.cache-paths.outputs.cache }} + ${{ steps.cache-paths.outputs.mod-cache }} + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- - name: Build Test v3 run: | - make build_test \ No newline at end of file + make build_test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5ee75d66..0f015a75 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,18 @@ jobs: go-version: ${{ matrix.go-version }} - name: Checkout code uses: actions/checkout@v2 + - id: cache-paths + run: | + echo "::set-output name=cache::$(go env GOCACHE)" + echo "::set-output name=mod-cache::$(go env GOMODCACHE)" + - name: Cache go modules + uses: actions/cache@v2 + with: + path: | + ${{ steps.cache-paths.outputs.cache }} + ${{ steps.cache-paths.outputs.mod-cache }} + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- - name: Test run: | - go test ./... \ No newline at end of file + go test ./...