From a345b148ae9263ac75c1992cfad080e34d310086 Mon Sep 17 00:00:00 2001 From: Pavel Zorin Date: Thu, 19 Oct 2023 20:11:45 +0200 Subject: [PATCH] test --- .buildkite/pipeline.yml | 114 +++++++++++++++--------------- .buildkite/scripts/steps/merge.sh | 22 ++++-- 2 files changed, 73 insertions(+), 63 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 7299c8d126c..bcdda2a58e6 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -32,73 +32,73 @@ steps: manual: allowed: true - # - label: "Unit tests - Windows 2022" - # key: "unit-tests-win2022" - # command: ".\\.buildkite\\scripts\\steps\\unit-tests.ps1" - # artifact_paths: - # - "build/TEST-**" - # - "build/diagnostics/*" - # agents: - # provider: "gcp" - # image: "family/core-windows-2022" - # machine_type: "n2-standard-8" - # disk_size: 200 - # disk_type: "pd-ssd" - # retry: - # manual: - # allowed: true + - label: "Unit tests - Windows 2022" + key: "unit-tests-win2022" + command: ".\\.buildkite\\scripts\\steps\\unit-tests.ps1" + artifact_paths: + - "build/TEST-**" + - "build/diagnostics/*" + agents: + provider: "gcp" + image: "family/core-windows-2022" + machine_type: "n2-standard-8" + disk_size: 200 + disk_type: "pd-ssd" + retry: + manual: + allowed: true + + - label: "Unit tests - Windows 2016" + key: "unit-tests-win2016" + command: ".\\.buildkite\\scripts\\steps\\unit-tests.ps1" + artifact_paths: + - "build/TEST-**" + - "build/diagnostics/*" + agents: + provider: "gcp" + image: "family/core-windows-2016" + machine_type: "n2-standard-8" + disk_size: 200 + disk_type: "pd-ssd" + retry: + manual: + allowed: true + - label: "Merge coverage reports" key: "merge-coverage" env: BUILDKITE_REPO: "" # skip checkout - command: ".buildkite/scripts/steps/merge.sh" + command: " + .buildkite/scripts/steps/merge.sh + unit-tests-2204 + unit-tests-2204-arm64 + unit-tests-win2016 + unit-tests-win2022 + " artifact_paths: - "build/TEST-**" agents: image: "golang:1.20.10" depends_on: - - "unit-tests-2204" - - "unit-tests-2204-arm64" - # plugins: - # - cultureamp/skip-checkout#v1.0.0: ~ - - # - "go install github.com/wadey/gocovmerge@latest" - # - "buildkite-agent artifact download --step unit-tests-2204 build/TEST-go-unit.cov coverage-unit-tests-2204.cov" - # - "buildkite-agent artifact download --step unit-tests-2204-arm64 build/TEST-go-unit.cov coverage-unit-tests-2204-arm64.cov ./" - # - "ls ./unit-tests-2204" - # - "gocovmerge coverage-unit-tests-2204.cov coverage-unit-tests-2204-arm64.cov > build/TEST-go-unit.cov" - # - "cat build/TEST-go-unit.cov" - - # - label: "Unit tests - Windows 2016" - # key: "unit-tests-win2016" - # command: ".\\.buildkite\\scripts\\steps\\unit-tests.ps1" - # artifact_paths: - # - "build/TEST-**" - # - "build/diagnostics/*" - # agents: - # provider: "gcp" - # image: "family/core-windows-2016" - # machine_type: "n2-standard-8" - # disk_size: 200 - # disk_type: "pd-ssd" - # retry: - # manual: - # allowed: true + - unit-tests-2204 + - unit-tests-2204-arm64 + - unit-tests-win2022 + - unit-tests-win2016 + allow_dependency_failure: true - # - label: ":sonarqube: Continuous Code Inspection" - # env: - # VAULT_SONAR_TOKEN_PATH: "kv/ci-shared/platform-ingest/elastic/elastic-agent/sonar-analyze-token" - # agents: - # image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest" - # command: - # - "buildkite-agent artifact download build/TEST-go-unit.cov ." - # - "buildkite-agent artifact download build/TEST-go-unit.out.json ." - # - "/scan-source-code.sh" - # depends_on: - # - "unit-tests" - # retry: - # manual: - # allowed: true + - label: ":sonarqube: Continuous Code Inspection" + env: + VAULT_SONAR_TOKEN_PATH: "kv/ci-shared/platform-ingest/elastic/elastic-agent/sonar-analyze-token" + agents: + image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest" + command: + - "buildkite-agent artifact download --step merge-coverage build/TEST-go-unit.cov ." + - "/scan-source-code.sh" + depends_on: + - "merge-coverage" + retry: + manual: + allowed: true # - label: "Integration tests" # key: "integration-tests" diff --git a/.buildkite/scripts/steps/merge.sh b/.buildkite/scripts/steps/merge.sh index 8f6bb4f545b..7cac4a0b1f6 100644 --- a/.buildkite/scripts/steps/merge.sh +++ b/.buildkite/scripts/steps/merge.sh @@ -1,11 +1,21 @@ +#!/bin/bash +# Downloads and merges coverage files from multiple steps into a single file (build/TEST-go-unit.cov). +# Usage: merge.sh ... Where is the id of the step that contains the coverage artifact.# + set -exuo pipefail COV_FILE="build/TEST-go-unit.cov" +# Space +COV_PATHS="" go install github.com/wadey/gocovmerge@latest -mkdir -p unit-tests-2204 && buildkite-agent artifact download --step unit-tests-2204 $COV_FILE unit-tests-2204 -mkdir -p unit-tests-2204-arm64 && buildkite-agent artifact download --step unit-tests-2204-arm64 $COV_FILE unit-tests-2204-arm64 -ls unit-tests-2204 -ls unit-tests-2204-arm64 -mkdir -p build && gocovmerge unit-tests-2204/$COV_FILE unit-tests-2204-arm64/$COV_FILE > $COV_FILE -cat build/TEST-go-unit.cov \ No newline at end of file +mkdir -p build + +for STEP_ID in "$@"; do + mkdir -p $STEP_ID + buildkite-agent artifact download --step $STEP_ID $COV_FILE $STEP_ID + COV_PATHS="${COV_PATHS} $STEP_ID/$COV_FILE" +done + +gocovmerge $COV_PATHS > $COV_FILE +echo "Merged coverage file: $COV_FILE. See artifacts" \ No newline at end of file