Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
herkolategan committed Jan 21, 2025
1 parent 9434611 commit a041098
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/code-cover-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
code-cover-gen:
if: false # This will always skip this job
runs-on: ubuntu-latest
env:
PR: ${{ github.event.pull_request.number }}
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/github-actions-essential-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ concurrency:
cancel-in-progress: true
jobs:
acceptance:
if: false # This will always skip this job
runs-on: [self-hosted, basic_big_runner_group]
timeout-minutes: 30
steps:
Expand All @@ -74,6 +75,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
check_generated_code:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
Expand All @@ -89,6 +91,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
docker_image_amd64:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
Expand All @@ -110,6 +113,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
examples_orms:
if: false # This will always skip this job
runs-on: [self-hosted, basic_big_runner_group]
timeout-minutes: 40
steps:
Expand All @@ -131,6 +135,7 @@ jobs:
run: ./cockroach/build/github/cleanup-engflow-keys.sh
if: always()
lint:
if: false # This will always skip this job
runs-on: [self-hosted, basic_big_runner_group]
timeout-minutes: 60
steps:
Expand All @@ -155,6 +160,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
local_roachtest:
if: false # This will always skip this job
runs-on: [self-hosted, basic_big_runner_group]
timeout-minutes: 60
steps:
Expand All @@ -176,6 +182,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
local_roachtest_fips:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group_fips]
timeout-minutes: 60
steps:
Expand All @@ -197,6 +204,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
linux_amd64_build:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
Expand All @@ -218,6 +226,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
linux_amd64_fips_build:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
Expand All @@ -239,6 +248,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
linux_arm64_build:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
Expand All @@ -260,6 +270,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
macos_amd64_build:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
Expand All @@ -281,6 +292,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
macos_arm64_build:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
Expand All @@ -302,6 +314,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
unit_tests:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 60
steps:
Expand All @@ -325,6 +338,7 @@ jobs:
run: ./build/github/cleanup-engflow-keys.sh
if: always()
windows_build:
if: false # This will always skip this job
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/microbenchmarks-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Microbench Build

on:
workflow_call:
inputs:
ref:
description: "Git reference to checkout (head or base commit)"
required: true
type: string

jobs:
build:
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
- name: Checkout HEAD commit for scripts
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: Copy build script
run: cp build/github/microbenchmarks-build.sh ${RUNNER_TEMP}/

- run: ./build/github/get-engflow-keys.sh

- name: Checkout build commit
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Build tests
run: ${RUNNER_TEMP}/microbenchmarks-build.sh
env:
BUILD_SHA: ${{ inputs.ref }}

- name: Clean up
run: ./build/github/cleanup-engflow-keys.sh
if: always()
66 changes: 66 additions & 0 deletions .github/workflows/microbenchmarks-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Microbenchmarks CI
on:
pull_request:
types: [ opened, reopened, synchronize ]
branches: [ master ]

permissions:
contents: write
pull-requests: write

jobs:
microbench-build-head:
if: false # This will always skip this job
name: Head Binaries
uses: ./.github/workflows/microbenchmarks-build.yaml
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

microbench-build-base:
if: false # This will always skip this job
name: Base Binaries
uses: ./.github/workflows/microbenchmarks-build.yaml
with:
ref: ${{ github.event.pull_request.base.sha }}

compare:
if: false # This will always skip this job
name: compare
runs-on: [self-hosted, basic_big_runner_group]
timeout-minutes: 30
needs: [microbench-build-head, microbench-build-base]
steps:
- name: Checkout HEAD commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: compare tests
run: build/github/microbenchmarks-compare.sh
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.ref }}

comment:
name: compare
runs-on: [self-hosted, basic_runner_group]
timeout-minutes: 30
steps:
- name: Checkout HEAD commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- run: ./build/github/get-engflow-keys.sh

- name: Summary
run: ./build/github/microbenchmarks-summary.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_REPOSITORY: ${{ github.repository }}

- name: Clean up
run: ./build/github/cleanup-engflow-keys.sh
if: always()
31 changes: 31 additions & 0 deletions build/github/microbenchmarks-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Copyright 2025 The Cockroach Authors.
#
# Use of this software is governed by the CockroachDB Software License
# included in the /LICENSE file.

set -euxo pipefail

storage_bucket="cockroach-microbench-ci"
output_url="gs://${storage_bucket}/builds/${BUILD_SHA}/pkg/sql/tests/tests_test_/tests_test"

# Disable parallel uploads, as it requires specific permissions
gcloud config set storage/parallel_composite_upload_enabled False

if gcloud storage ls "${output_url}" &>/dev/null; then
echo "Build for $BUILD_SHA already exists. Skipping..."
exit 0
fi

bazel build //pkg/sql/tests:tests_test \
--jobs 100 \
--crdb_test_off \
--bes_keywords integration-test-artifact-build \
--config=crosslinux \
--remote_download_minimal \
$(./build/github/engflow-args.sh)

# Copy the binary to a GCS cache
bazel_bin=$(bazel info bazel-bin --config=crosslinux)
gcloud storage cp "${bazel_bin}/pkg/sql/tests/tests_test_/tests_test" "${output_url}"
24 changes: 24 additions & 0 deletions build/github/microbenchmarks-compare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Copyright 2025 The Cockroach Authors.
#
# Use of this software is governed by the CockroachDB Software License
# included in the /LICENSE file.

set -euxo pipefail

storage_bucket="cockroach-microbench-ci"
base_url="gs://${storage_bucket}/builds/${BASE_SHA}/pkg/sql/tests/tests_test_/tests_test"
head_url="gs://${storage_bucket}/builds/${HEAD_SHA}/pkg/sql/tests/tests_test_/tests_test"

mkdir -p base head
gcloud storage cp "${base_url}" base/tests_test
gcloud storage cp "${head_url}" head/tests_test
chmod +x base/tests_test head/tests_test

export COCKROACH_RANDOM_SEED=1
# Run the benchmarks for 10 loops
for _ in {1..10}; do
./base/tests_test -test.run=^$ -test.v -test.benchmem -test.bench=BenchmarkSysbench/SQL/3node/oltp_read_write -test.count=1 -test.benchtime=2000x
./head/tests_test -test.run=^$ -test.v -test.benchmem -test.bench=BenchmarkSysbench/SQL/3node/oltp_read_write -test.count=1 -test.benchtime=2000x
done
15 changes: 15 additions & 0 deletions build/github/microbenchmarks-summary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Copyright 2025 The Cockroach Authors.
#
# Use of this software is governed by the CockroachDB Software License
# included in the /LICENSE file.

bazel build --config=crosslinux $(./build/github/engflow-args.sh) \
--jobs 100 \
--bes_keywords integration-test-artifact-build \
//pkg/cmd/microbench-ci \

bazel_bin=$(bazel info bazel-bin --config=crosslinux)

$bazel_bin/pkg/cmd/microbench-ci/microbench-ci_/microbench-ci
2 changes: 2 additions & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,8 @@ GO_TARGETS = [
"//pkg/cmd/label-merged-pr:label-merged-pr",
"//pkg/cmd/label-merged-pr:label-merged-pr_lib",
"//pkg/cmd/label-merged-pr:label-merged-pr_test",
"//pkg/cmd/microbench-ci:microbench-ci",
"//pkg/cmd/microbench-ci:microbench-ci_lib",
"//pkg/cmd/mirror/go:go_lib",
"//pkg/cmd/mirror/go:go_test",
"//pkg/cmd/mirror/go:mirror",
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/dev/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var buildTargetMapping = map[string]string{
"geos": geosTarget,
"langgen": "//pkg/sql/opt/optgen/cmd/langgen:langgen",
"libgeos": geosTarget,
"microbench-ci": "//pkg/cmd/microbench-ci:microbench-ci",
"optgen": "//pkg/sql/opt/optgen/cmd/optgen:optgen",
"optfmt": "//pkg/sql/opt/optgen/cmd/optfmt:optfmt",
"reduce": "//pkg/cmd/reduce:reduce",
Expand Down
18 changes: 18 additions & 0 deletions pkg/cmd/microbench-ci/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "microbench-ci_lib",
srcs = ["main.go"],
importpath = "github.com/cockroachdb/cockroach/pkg/cmd/microbench-ci",
visibility = ["//visibility:private"],
deps = [
"@com_github_google_go_github_v61//github",
"@org_golang_x_oauth2//:oauth2",
],
)

go_binary(
name = "microbench-ci",
embed = [":microbench-ci_lib"],
visibility = ["//visibility:public"],
)
Loading

0 comments on commit a041098

Please sign in to comment.