Skip to content

Commit

Permalink
setup-go github action does all the env setup (open-telemetry#5336)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored May 11, 2022
1 parent 9d84bff commit 7f66c9c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 52 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build-and-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Setup Go Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- name: Cache Go
uses: actions/cache@v3
env:
Expand Down
28 changes: 4 additions & 24 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Setup Go Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Cache Go
id: go-cache
uses: actions/cache@v3
Expand All @@ -34,6 +30,7 @@ jobs:
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools

lint:
runs-on: ubuntu-latest
needs: [setup-environment]
Expand All @@ -44,10 +41,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Setup Go Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Cache Go
id: go-cache
uses: actions/cache@v3
Expand All @@ -71,10 +64,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Setup Go Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Cache Go
id: go-cache
uses: actions/cache@v3
Expand Down Expand Up @@ -111,6 +100,7 @@ jobs:
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)
- name: Multimod verify
run: make multimod-verify

unittest:
strategy:
matrix:
Expand All @@ -124,10 +114,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Setup Go Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Cache Go
id: go-cache
uses: actions/cache@v3
Expand All @@ -143,6 +129,7 @@ jobs:
key: unittest-${{ runner.os }}-go-build-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
- name: Run Unit Tests
run: make gotest

test-coverage:
runs-on: ubuntu-latest
needs: [setup-environment]
Expand All @@ -153,10 +140,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Setup Go Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Cache Go
id: go-cache
uses: actions/cache@v3
Expand All @@ -178,6 +161,7 @@ jobs:
file: ./coverage.txt
fail_ci_if_error: true
verbose: true

cross-build-collector:
needs: [setup-environment]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -212,10 +196,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Setup Go Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Cache Go
id: go-cache
uses: actions/cache@v3
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/builder-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ on:
jobs:
integration-test:
name: Integration test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Test
run: cd ./cmd/builder && ./test/test.sh
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Test
run: cd ./cmd/builder && ./test/test.sh
11 changes: 4 additions & 7 deletions .github/workflows/builder-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ on:

jobs:
goreleaser:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
-
name: Run GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser-pro
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ on:
jobs:
contrib_tests:
runs-on: ubuntu-latest
container:
image: cimg/go:1.17
steps:
- name: Setup Permissions
run: sudo chmod -R 777 $GITHUB_WORKSPACE /github /__w/_temp
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Run Contrib Tests
run: |
contrib_path=/tmp/opentelemetry-collector-contrib
Expand Down

0 comments on commit 7f66c9c

Please sign in to comment.