Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
pazone committed Oct 19, 2023
1 parent 542556e commit a345b14
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 63 deletions.
114 changes: 57 additions & 57 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 16 additions & 6 deletions .buildkite/scripts/steps/merge.sh
Original file line number Diff line number Diff line change
@@ -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 <step1> <step2> ... Where <step> 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
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"

0 comments on commit a345b14

Please sign in to comment.