diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 7d279b090..52bd9f3bc 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -31,6 +31,13 @@ steps: cpu: "8" memory: "4G" + - label: ":building_construction: Run local build: MacOS" + key: make-local-macos + command: ".buildkite/scripts/local_build.sh" + agents: + provider: orka + imagePrefix: generic-13-ventura-arm + - group: "Performance test" key: "performance-test" steps: @@ -77,7 +84,17 @@ steps: provider: "gcp" artifact_paths: - build/*.xml - - build/coverage.out + - build/coverage*.out + + - label: ":smartbear-testexecute: Run unit tests: MacOS 13" + key: unit-test-macos-13 + command: ".buildkite/scripts/unit_test.sh" + agents: + provider: orka + imagePrefix: generic-13-ventura-arm + artifact_paths: + - build/*.xml + - build/coverage*.out - label: ":smartbear-testexecute: Run integration tests" key: int-test @@ -105,6 +122,8 @@ steps: depends_on: - step: "unit-test" allow_failure: true + - step: "unit-test-macos-13" + allow_failure: true - step: "int-test" allow_failure: true - step: "e2e-test" @@ -116,14 +135,16 @@ steps: agents: image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest" command: - - "buildkite-agent artifact download build/*coverage.out ." - - "buildkite-agent artifact download build/test-unit.out.xml ." + - "buildkite-agent artifact download build/*coverage*.out ." + - "buildkite-agent artifact download build/test-unit*.out.xml ." - "/scan-source-code.sh" depends_on: - step: "unit-test" allow_failure: false - step: "e2e-test" allow_failure: false + - step: "unit-test-macos-13" + allow_failure: false - label: ":gcloud: Cloud e2e Test" key: "cloud-e2e-test" diff --git a/.buildkite/scripts/common.sh b/.buildkite/scripts/common.sh index 5018d0210..5fb206666 100755 --- a/.buildkite/scripts/common.sh +++ b/.buildkite/scripts/common.sh @@ -5,8 +5,7 @@ set -euo pipefail WORKSPACE="$(pwd)/bin" TMP_FOLDER_TEMPLATE_BASE="tmp.fleet-server" REPO="fleet-server" -platform_type="$(uname)" -platform_type_lowercase="${platform_type,,}" +platform_type=$(uname | tr '[:upper:]' '[:lower:]') hw_type="$(uname -m)" check_platform_architeture() { @@ -43,7 +42,7 @@ with_go() { echo "Setting up the Go environment..." create_workspace check_platform_architeture - retry 5 curl -sL -o ${WORKSPACE}/gvm "https://github.com/andrewkroh/gvm/releases/download/${SETUP_GVM_VERSION}/gvm-${platform_type_lowercase}-${arch_type}" + retry 5 curl -sL -o ${WORKSPACE}/gvm "https://github.com/andrewkroh/gvm/releases/download/${SETUP_GVM_VERSION}/gvm-${platform_type}-${arch_type}" chmod +x ${WORKSPACE}/gvm eval "$(gvm $(cat .go-version))" go version @@ -54,7 +53,7 @@ with_go() { with_docker_compose() { echo "Setting up the Docker-compose environment..." create_workspace - retry 5 curl -sSL -o ${WORKSPACE}/docker-compose "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-${platform_type_lowercase}-${hw_type}" + retry 5 curl -sSL -o ${WORKSPACE}/docker-compose "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-${platform_type}-${hw_type}" chmod +x ${WORKSPACE}/docker-compose docker-compose version } @@ -88,7 +87,7 @@ with_Terraform() { local path_to_file="${WORKSPACE}/terraform.zip" create_workspace check_platform_architeture - retry 5 curl -sSL -o ${path_to_file} "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${platform_type_lowercase}_${arch_type}.zip" + retry 5 curl -sSL -o ${path_to_file} "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${platform_type}_${arch_type}.zip" unzip -q ${path_to_file} -d ${WORKSPACE}/ rm ${path_to_file} chmod +x ${WORKSPACE}/terraform diff --git a/.buildkite/scripts/local_build.sh b/.buildkite/scripts/local_build.sh new file mode 100644 index 000000000..57479cf30 --- /dev/null +++ b/.buildkite/scripts/local_build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -euo pipefail + +source .buildkite/scripts/common.sh +add_bin_path +with_go + +make local \ No newline at end of file diff --git a/Makefile b/Makefile index b03ce438b..e9ce6c160 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,8 @@ endif # Directory to dump build tools into GOBIN=$(shell go env GOPATH)/bin/ +OS_NAME:=$(shell uname -s) + .PHONY: help help: ## - Show help message @printf "${CMD_COLOR_ON} usage: make [target]\n\n${CMD_COLOR_OFF}" @@ -158,7 +160,7 @@ test-release: ## - Check that all release binaries are created .PHONY: test-unit test-unit: prepare-test-context ## - Run unit tests only - set -o pipefail; go test ${GO_TEST_FLAG} -v -race -coverprofile=build/coverage.out ./... | tee build/test-unit.out + set -o pipefail; go test ${GO_TEST_FLAG} -v -race -coverprofile=build/coverage-${OS_NAME}.out ./... | tee build/test-unit-${OS_NAME}.out .PHONY: benchmark benchmark: prepare-test-context install-benchstat ## - Run benchmark tests only diff --git a/sonar-project.properties b/sonar-project.properties index 88f5e6d71..c54fb0e51 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,8 +6,8 @@ sonar.exclusions=**/*_test.go, .git/**, dev-tools/**, /magefile.go, changelog/** sonar.tests=. sonar.test.inclusions=**/*_test.go -sonar.go.tests.reportPaths=build/test-unit.out.xml -sonar.go.coverage.reportPaths=**/build/coverage.out,**/build/e2e-coverage.out +sonar.go.tests.reportPaths=build/test-unit*.out.xml +sonar.go.coverage.reportPaths=**/build/coverage*.out,**/build/e2e-coverage.out sonar.go.exclusions=**/vendor/**,**/*_mock.go sonar.sourceEncoding=UTF-8