diff --git a/.circleci/config.yml b/.circleci/config.yml index c3fcfcebd..51c7cc2b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,9 +24,17 @@ jobs: - run: command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} 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 rm -rf /tmp/golang.tar.gz name: install golang @@ -100,9 +108,17 @@ jobs: - run: command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} 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 rm -rf /tmp/golang.tar.gz name: install golang @@ -176,9 +192,17 @@ jobs: - run: command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} 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 rm -rf /tmp/golang.tar.gz name: install golang @@ -252,9 +276,17 @@ jobs: - run: command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} 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 rm -rf /tmp/golang.tar.gz name: install golang @@ -328,9 +360,17 @@ jobs: - run: command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} 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 rm -rf /tmp/golang.tar.gz name: install golang @@ -490,9 +530,17 @@ jobs: - run: command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} 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 rm -rf /tmp/golang.tar.gz name: install golang @@ -605,6 +653,51 @@ jobs: path: /tmp/test-reports - store_artifacts: 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: machine: image: circleci/classic:201808-01 @@ -625,9 +718,17 @@ jobs: - run: command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} 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 rm -rf /tmp/golang.tar.gz name: install golang @@ -761,9 +862,17 @@ jobs: - run: command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} 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 rm -rf /tmp/golang.tar.gz name: install golang @@ -833,6 +942,13 @@ workflows: - /^.-ui\b.*/ - /^docs-.*/ - stable-website + - build-darwin-binaries: + filters: + branches: + ignore: + - /^.-ui\b.*/ + - /^docs-.*/ + - stable-website - test-client: filters: branches: diff --git a/.circleci/config/commands/install-golang.yml b/.circleci/config/commands/install-golang.yml index 485ffd9e1..4f0771fd7 100644 --- a/.circleci/config/commands/install-golang.yml +++ b/.circleci/config/commands/install-golang.yml @@ -1,10 +1,23 @@ +parameters: + target_directory: + type: string + default: /usr/local + steps: - run: name: install golang command: | set -x + + os="linux" + if [[ "$OSTYPE" == "darwin"* ]] + then + os="darwin" + fi + echo installing golang ${GOLANG_VERSION} - 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 tar -C /usr/local -xzf /tmp/golang.tar.gz + sudo rm -rf << parameters.target_directory >>/go + sudo mkdir -p << parameters.target_directory >> + 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 diff --git a/.circleci/config/config.yml b/.circleci/config/config.yml index 214bc2ad6..bb98e74fa 100644 --- a/.circleci/config/config.yml +++ b/.circleci/config/config.yml @@ -42,3 +42,12 @@ executors: machine: image: *go_machine_recent_image 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 diff --git a/.circleci/config/jobs/build-darwin-binaries.yml b/.circleci/config/jobs/build-darwin-binaries.yml new file mode 100644 index 000000000..ad0abe8d9 --- /dev/null +++ b/.circleci/config/jobs/build-darwin-binaries.yml @@ -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 diff --git a/.circleci/config/workflows/build-test.yml b/.circleci/config/workflows/build-test.yml index 3edf4234d..6184f1713 100644 --- a/.circleci/config/workflows/build-test.yml +++ b/.circleci/config/workflows/build-test.yml @@ -14,6 +14,12 @@ jobs: - /^.-ui\b.*/ - /^docs-.*/ - stable-website + +- build-darwin-binaries: + # almost always build binaries as they may be needed + # for e2e tests + filters: *backend_branches_filter + - test-machine: name: "test-client" test_packages: "./client/..."