Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] MacOS 13 Unit tests #3253

Merged
merged 9 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ steps:
cpu: "8"
memory: "4G"

- label: ":building_construction: Run local build: MacOS"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pazone, what's the reason we build this? IIUC, the tests step does not use these artifacts? Or am i seeing this wrongly?

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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
9 changes: 4 additions & 5 deletions .buildkite/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions .buildkite/scripts/local_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -euo pipefail

source .buildkite/scripts/common.sh
add_bin_path
with_go

make local
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down