Skip to content

Commit

Permalink
Move cache/go-build in a different cache to allow unittest/coverage t…
Browse files Browse the repository at this point in the history
…o use it (open-telemetry#4289)

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Oct 28, 2021
1 parent 72e4e3f commit 5abd73a
Showing 1 changed file with 15 additions and 33 deletions.
48 changes: 15 additions & 33 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,15 @@ jobs:
- name: Cache Go
id: module-cache
uses: actions/cache@v2
env:
cache-name: cache-go-modules
with:
path: |
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
path: /home/runner/go/pkg/mod
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Install dependencies
if: steps.module-cache.outputs.cache-hit != 'true'
run: make gomoddownload
- name: Cache Tools
id: tool-cache
uses: actions/cache@v2
env:
cache-name: cache-tool-binaries
with:
path: /home/runner/go/bin
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }}
Expand All @@ -65,18 +59,12 @@ jobs:
- name: Cache Go
id: module-cache
uses: actions/cache@v2
env:
cache-name: cache-go-modules
with:
path: |
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
path: /home/runner/go/pkg/mod
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Cache Tools
id: tool-cache
uses: actions/cache@v2
env:
cache-name: cache-tool-binaries
with:
path: /home/runner/go/bin
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }}
Expand Down Expand Up @@ -113,21 +101,20 @@ jobs:
- name: Cache Go
id: module-cache
uses: actions/cache@v2
env:
cache-name: cache-go-modules
with:
path: |
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
path: /home/runner/go/pkg/mod
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Cache Tools
id: tool-cache
uses: actions/cache@v2
env:
cache-name: cache-tool-binaries
with:
path: /home/runner/go/bin
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }}
- name: Cache Build
uses: actions/cache@v2
with:
path: /home/runner/.cache/go-build
key: go-build-unittest-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Run Unit Tests
run: make gotest
test-coverage:
Expand All @@ -147,21 +134,20 @@ jobs:
- name: Cache Go
id: module-cache
uses: actions/cache@v2
env:
cache-name: cache-go-modules
with:
path: |
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
path: /home/runner/go/pkg/mod
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Cache Tools
id: tool-cache
uses: actions/cache@v2
env:
cache-name: cache-tool-binaries
with:
path: /home/runner/go/bin
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }}
- name: Cache Build
uses: actions/cache@v2
with:
path: /home/runner/.cache/go-build
key: go-build-coverage-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Run Unit Tests With Coverage
run: make gotest-with-cover
- name: Upload coverage report
Expand All @@ -187,12 +173,8 @@ jobs:
- name: Cache Go
id: module-cache
uses: actions/cache@v2
env:
cache-name: cache-go-modules
with:
path: |
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
path: /home/runner/go/pkg/mod
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Build Collector for All Architectures
run: make binaries-all-sys
Expand Down

0 comments on commit 5abd73a

Please sign in to comment.