Skip to content

Commit

Permalink
Use Makefile operator to get GOARCH default
Browse files Browse the repository at this point in the history
* Fix bash syntax default for ENV var by using Makefile var syntax
* Provide a PR build time test to test the different architectures
  • Loading branch information
NathanielRN committed Nov 25, 2021
1 parent ec6374c commit e3531b7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/pr-collector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Collector on PR

on:
pull_request:
branches: [ main ]

jobs:
build-collector:
runs-on: ubuntu-20.04
name: Check if we can build the collector for ${{ matrix.architecture }}
strategy:
matrix:
architecture: [ amd64, arm64 ]
steps:
- name: Checkout this repo
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.16'
- name: Build collector
run: GOARCH=${{ matrix.architecture }} make package
working-directory: collector
- name: Confirm architecture of built collector
working-directory: collector/build/extensions
run: |
if [ "${{ matrix.architecture }}" = "amd64" ]
then
SEARCH_STRING=x86
elif [ "${{ matrix.architecture }}" = "arm64" ]
then
SEARCH_STRING=ARM
else
exit 2
fi
grep "$SEARCH_STRING" <<< "$(file collector)"
2 changes: 1 addition & 1 deletion collector/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LAYER_NAME:=otel-collector

VERSION=$(shell cat VERSION)
GIT_SHA=$(shell git rev-parse HEAD)
GOARCH=${GOARCH-amd64}
GOARCH ?= amd64
GOBUILD=GO111MODULE=on CGO_ENABLED=0 installsuffix=cgo go build -trimpath
BUILD_INFO_IMPORT_PATH=main

Expand Down

0 comments on commit e3531b7

Please sign in to comment.