mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-18 03:22:12 +02:00
feat(gh-workflows): Use cache-dependency-path in actions/setup-go for ci workflow (#4074)
Using cache-dependency-path (which is now a built-in functionality in actions/setup-go), the speed of runs on MacOS can be improved. Refs: #3911 Co-authored-by: Robert Pająk <pellared@hotmail.com> Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
parent
02c0001307
commit
7971a12308
56
.github/workflows/ci.yml
vendored
56
.github/workflows/ci.yml
vendored
@ -19,23 +19,17 @@ jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
- name: Module cache
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: go-mod-cache
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }}
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
cache-dependency-path: "**/go.sum"
|
||||
- name: Tools cache
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
@ -53,46 +47,34 @@ jobs:
|
||||
test-race:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
- name: Module cache
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: go-mod-cache
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }}
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
cache-dependency-path: "**/go.sum"
|
||||
- name: Run tests with race detector
|
||||
run: make test-race
|
||||
|
||||
test-coverage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
- name: Module cache
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: go-mod-cache
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }}
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
cache-dependency-path: "**/go.sum"
|
||||
- name: Run coverage tests
|
||||
run: |
|
||||
make test-coverage
|
||||
@ -128,10 +110,6 @@ jobs:
|
||||
arch: "386"
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Environment
|
||||
@ -139,13 +117,11 @@ jobs:
|
||||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
shell: bash
|
||||
- name: Module cache
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: go-mod-cache
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }}
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache-dependency-path: "**/go.sum"
|
||||
- name: Run tests
|
||||
env:
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
|
Loading…
Reference in New Issue
Block a user