ci: build darwin on CI

build darwin binaries in CI as a basic check.  Protects against
cross compile issues.
This commit is contained in:
Mahmood Ali 2020-03-23 11:28:54 -04:00
parent 8142d42f85
commit 4f6a2cf65c
5 changed files with 172 additions and 11 deletions

132
.circleci/config.yml generated
View file

@ -24,9 +24,17 @@ jobs:
- run: - run:
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p /usr/local
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz
name: install golang name: install golang
@ -100,9 +108,17 @@ jobs:
- run: - run:
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p /usr/local
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz
name: install golang name: install golang
@ -176,9 +192,17 @@ jobs:
- run: - run:
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p /usr/local
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz
name: install golang name: install golang
@ -252,9 +276,17 @@ jobs:
- run: - run:
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p /usr/local
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz
name: install golang name: install golang
@ -328,9 +360,17 @@ jobs:
- run: - run:
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p /usr/local
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz
name: install golang name: install golang
@ -490,9 +530,17 @@ jobs:
- run: - run:
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p /usr/local
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz
name: install golang name: install golang
@ -605,6 +653,51 @@ jobs:
path: /tmp/test-reports path: /tmp/test-reports
- store_artifacts: - store_artifacts:
path: /tmp/test-reports path: /tmp/test-reports
build-darwin-binaries:
macos:
xcode: 11.3.1
working_directory: ~/go/src/github.com/hashicorp/nomad
steps:
- checkout
- run:
command: echo 'export PATH="${GOPATH}/bin:${HOME}/goinstall/go/bin:$PATH"' >> ${BASH_ENV}
name: configure PATH
- run:
command: |
set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION}
sudo rm -rf ~/goinstall/go
sudo mkdir -p ~/goinstall
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C ~/goinstall -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz
name: install golang
- run:
command: source ${BASH_ENV} && make deps
- run:
command: brew install protobuf
- run:
command: sudo -E PATH="$GOPATH/bin:${HOME}/goinstall/go/bin:$PATH" make generate-structs
- run:
command: source ${BASH_ENV} && make pkg/darwin_amd64.zip
- store_artifacts:
destination: /builds/nomad_darwin_amd64.zip
path: pkg/windows_amd64.zip
environment:
- GIT_PAGER: cat
- GOLANG_VERSION: 1.14
- GOMAXPROCS: 1
- GOPATH: /Users/distiller/go
- GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml
- NOMAD_SLOW_TEST: 1
- PAGER: cat
test-docker: test-docker:
machine: machine:
image: circleci/classic:201808-01 image: circleci/classic:201808-01
@ -625,9 +718,17 @@ jobs:
- run: - run:
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p /usr/local
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz
name: install golang name: install golang
@ -761,9 +862,17 @@ jobs:
- run: - run:
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p /usr/local
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz
name: install golang name: install golang
@ -833,6 +942,13 @@ workflows:
- /^.-ui\b.*/ - /^.-ui\b.*/
- /^docs-.*/ - /^docs-.*/
- stable-website - stable-website
- build-darwin-binaries:
filters:
branches:
ignore:
- /^.-ui\b.*/
- /^docs-.*/
- stable-website
- test-client: - test-client:
filters: filters:
branches: branches:

View file

@ -1,10 +1,23 @@
parameters:
target_directory:
type: string
default: /usr/local
steps: steps:
- run: - run:
name: install golang name: install golang
command: | command: |
set -x set -x
os="linux"
if [[ "$OSTYPE" == "darwin"* ]]
then
os="darwin"
fi
echo installing golang ${GOLANG_VERSION} echo installing golang ${GOLANG_VERSION}
sudo rm -rf /usr/local/go sudo rm -rf << parameters.target_directory >>/go
wget -O /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz sudo mkdir -p << parameters.target_directory >>
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.${os}-amd64.tar.gz
sudo tar -C << parameters.target_directory >> -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz rm -rf /tmp/golang.tar.gz

View file

@ -42,3 +42,12 @@ executors:
machine: machine:
image: *go_machine_recent_image image: *go_machine_recent_image
environment: *machine_env environment: *machine_env
go-macos:
working_directory: ~/go/src/github.com/hashicorp/nomad
macos:
xcode: 11.3.1
environment:
<<: *common_envs
GOPATH: /Users/distiller/go
GOLANG_VERSION: 1.14

View file

@ -0,0 +1,17 @@
executor: go-macos
steps:
- checkout
- run:
name: configure PATH
command:
echo 'export PATH="${GOPATH}/bin:${HOME}/goinstall/go/bin:$PATH"' >> ${BASH_ENV}
- install-golang:
target_directory: ~/goinstall
- run: source ${BASH_ENV} && make deps
- run: brew install protobuf
- run: sudo -E PATH="$GOPATH/bin:${HOME}/goinstall/go/bin:$PATH" make generate-structs
- run: source ${BASH_ENV} && make pkg/darwin_amd64.zip
- store_artifacts:
path: pkg/windows_amd64.zip
destination: /builds/nomad_darwin_amd64.zip

View file

@ -14,6 +14,12 @@ jobs:
- /^.-ui\b.*/ - /^.-ui\b.*/
- /^docs-.*/ - /^docs-.*/
- stable-website - stable-website
- build-darwin-binaries:
# almost always build binaries as they may be needed
# for e2e tests
filters: *backend_branches_filter
- test-machine: - test-machine:
name: "test-client" name: "test-client"
test_packages: "./client/..." test_packages: "./client/..."