Skip to content

Commit 7f66c9c

Browse files
authored
setup-go github action does all the env setup (#5336)
Signed-off-by: Bogdan Drutu <[email protected]>
1 parent 9d84bff commit 7f66c9c

File tree

5 files changed

+21
-52
lines changed

5 files changed

+21
-52
lines changed

.github/workflows/build-and-test-windows.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ jobs:
1616
uses: actions/setup-go@v3
1717
with:
1818
go-version: 1.17
19-
- name: Setup Go Environment
20-
run: |
21-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
22-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
23-
shell: bash
2419
- name: Cache Go
2520
uses: actions/cache@v3
2621
env:

.github/workflows/build-and-test.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ jobs:
1616
uses: actions/setup-go@v3
1717
with:
1818
go-version: 1.17
19-
- name: Setup Go Environment
20-
run: |
21-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
22-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
2319
- name: Cache Go
2420
id: go-cache
2521
uses: actions/cache@v3
@@ -34,6 +30,7 @@ jobs:
3430
- name: Install Tools
3531
if: steps.go-cache.outputs.cache-hit != 'true'
3632
run: make install-tools
33+
3734
lint:
3835
runs-on: ubuntu-latest
3936
needs: [setup-environment]
@@ -44,10 +41,6 @@ jobs:
4441
uses: actions/setup-go@v3
4542
with:
4643
go-version: 1.17
47-
- name: Setup Go Environment
48-
run: |
49-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
50-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
5144
- name: Cache Go
5245
id: go-cache
5346
uses: actions/cache@v3
@@ -71,10 +64,6 @@ jobs:
7164
uses: actions/setup-go@v3
7265
with:
7366
go-version: 1.17
74-
- name: Setup Go Environment
75-
run: |
76-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
77-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
7867
- name: Cache Go
7968
id: go-cache
8069
uses: actions/cache@v3
@@ -111,6 +100,7 @@ jobs:
111100
git diff -s --exit-code || (echo 'Generated code is out of date, please run "make genotelcorecol" and commit the changes in this PR.' && exit 1)
112101
- name: Multimod verify
113102
run: make multimod-verify
103+
114104
unittest:
115105
strategy:
116106
matrix:
@@ -124,10 +114,6 @@ jobs:
124114
uses: actions/setup-go@v3
125115
with:
126116
go-version: ${{ matrix.go-version }}
127-
- name: Setup Go Environment
128-
run: |
129-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
130-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
131117
- name: Cache Go
132118
id: go-cache
133119
uses: actions/cache@v3
@@ -143,6 +129,7 @@ jobs:
143129
key: unittest-${{ runner.os }}-go-build-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
144130
- name: Run Unit Tests
145131
run: make gotest
132+
146133
test-coverage:
147134
runs-on: ubuntu-latest
148135
needs: [setup-environment]
@@ -153,10 +140,6 @@ jobs:
153140
uses: actions/setup-go@v3
154141
with:
155142
go-version: 1.17
156-
- name: Setup Go Environment
157-
run: |
158-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
159-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
160143
- name: Cache Go
161144
id: go-cache
162145
uses: actions/cache@v3
@@ -178,6 +161,7 @@ jobs:
178161
file: ./coverage.txt
179162
fail_ci_if_error: true
180163
verbose: true
164+
181165
cross-build-collector:
182166
needs: [setup-environment]
183167
runs-on: ubuntu-latest
@@ -212,10 +196,6 @@ jobs:
212196
uses: actions/setup-go@v3
213197
with:
214198
go-version: 1.17
215-
- name: Setup Go Environment
216-
run: |
217-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
218-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
219199
- name: Cache Go
220200
id: go-cache
221201
uses: actions/cache@v3

.github/workflows/builder-integration-test.yaml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ on:
2323
jobs:
2424
integration-test:
2525
name: Integration test
26-
runs-on: ubuntu-20.04
26+
runs-on: ubuntu-latest
2727
steps:
28-
29-
- name: Set up Go
30-
uses: actions/setup-go@v3
31-
with:
32-
go-version: 1.17
33-
34-
- name: Check out code into the Go module directory
35-
uses: actions/checkout@v3
36-
37-
- name: Test
38-
run: cd ./cmd/builder && ./test/test.sh
28+
- name: Checkout Repo
29+
uses: actions/checkout@v3
30+
- name: Setup Go
31+
uses: actions/setup-go@v3
32+
with:
33+
go-version: 1.17
34+
- name: Test
35+
run: cd ./cmd/builder && ./test/test.sh

.github/workflows/builder-release.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,17 @@ on:
77

88
jobs:
99
goreleaser:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-latest
1111
steps:
12-
-
13-
name: Checkout
12+
- name: Checkout Repo
1413
uses: actions/checkout@v3
1514
with:
1615
fetch-depth: 0
17-
-
18-
name: Set up Go
16+
- name: Setup Go
1917
uses: actions/setup-go@v3
2018
with:
2119
go-version: 1.17
22-
-
23-
name: Run GoReleaser
20+
- name: Run GoReleaser
2421
uses: goreleaser/goreleaser-action@v2
2522
with:
2623
distribution: goreleaser-pro

.github/workflows/contrib-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ on:
99
jobs:
1010
contrib_tests:
1111
runs-on: ubuntu-latest
12-
container:
13-
image: cimg/go:1.17
1412
steps:
15-
- name: Setup Permissions
16-
run: sudo chmod -R 777 $GITHUB_WORKSPACE /github /__w/_temp
1713
- name: Checkout Repo
1814
uses: actions/checkout@v3
15+
- name: Setup Go
16+
uses: actions/setup-go@v3
17+
with:
18+
go-version: 1.17
1919
- name: Run Contrib Tests
2020
run: |
2121
contrib_path=/tmp/opentelemetry-collector-contrib

0 commit comments

Comments
 (0)