From 9ca2c4221d7f98d5bcafc06c49d9f102797eaa91 Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Tue, 5 Apr 2022 16:04:16 +0100 Subject: [PATCH] [ci] Cross build for architectures (#5142) * [ci] Do cross architecture build of collector This job will help to see if any issues introduced to cross binary builds, when a commit is pushed. Signed-off-by: Martin Hickey * Sync cross build list with opentelemetry-collector-releases Update following review comment: https://github.com/open-telemetry/opentelemetry-collector/pull/5142#discussion_r842541349 Signed-off-by: Martin Hickey * Disable darwin 386 build Go 1.15 dropped support for 32-bit binaries on macOS: https://go.dev/doc/go1.15 Signed-off-by: Martin Hickey --- .github/workflows/build-and-test.yml | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4245f2ef7c5..bd1338dfc26 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -198,3 +198,59 @@ jobs: file: ./coverage.txt fail_ci_if_error: true verbose: true + cross-build-collector: + needs: [setup-environment] + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + include: + # Go 1.15 dropped support for 32-bit binaries + # on macOS: https://go.dev/doc/go1.15 + #- goos: darwin + # goarch: 386 + - goos: darwin + goarch: amd64 + - goos: darwin + goarch: arm64 + - goos: linux + goarch: 386 + - goos: linux + goarch: amd64 + - goos: linux + goarch: arm64 + - goos: windows + goarch: 386 + - goos: windows + goarch: amd64 + + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Setup Go + 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: module-cache + uses: actions/cache@v3 + with: + path: /home/runner/go/pkg/mod + key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Cache Tools + id: tool-cache + uses: actions/cache@v3 + with: + path: /home/runner/go/bin + key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }} + - name: Build + env: + GOOS: ${{matrix.goos}} + GOARCH: ${{matrix.goarch}} + run: | + make otelcorecol \ No newline at end of file