action: support bazel crossbuild and upload the cache (#65474)
This commit is contained in:
31
.github/actions/tidb_build/action.yml
vendored
Normal file
31
.github/actions/tidb_build/action.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: TiDB Build
|
||||
description: Common steps to run TiDB Bazel build cross-platform
|
||||
inputs:
|
||||
go-version:
|
||||
description: Go version to setup
|
||||
required: false
|
||||
default: "1.25"
|
||||
bazelrc:
|
||||
description: Bazelrc content from secrets
|
||||
required: true
|
||||
gcp_sa_key:
|
||||
description: GCP service account key JSON content
|
||||
required: true
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Set up bazelisk
|
||||
uses: bazel-contrib/setup-bazel@0.16.0
|
||||
with:
|
||||
bazelisk-cache: true
|
||||
repository-cache: true
|
||||
external-cache: false
|
||||
disk-cache: ${{ github.workflow }}}
|
||||
google-credentials: ${{ inputs.gcp_sa_key }}
|
||||
bazelrc: ${{ inputs.bazelrc }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
cache: false
|
||||
43
.github/workflows/bazel-build-crossbuild.yml
vendored
Normal file
43
.github/workflows/bazel-build-crossbuild.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: Bazel Crossbuild for TiDB/Lightning
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
master:
|
||||
name: Bazel Crossbuild
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- macos
|
||||
- ubuntu
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Build Prepare
|
||||
uses: ./.github/actions/tidb_build
|
||||
with:
|
||||
bazelrc: ${{ secrets.BAZELRC }}
|
||||
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
|
||||
go-version: 1.25
|
||||
- name: Run Build
|
||||
shell: bash
|
||||
run: |
|
||||
#!/bin/bash
|
||||
unset CI
|
||||
system_name=$(uname -s)
|
||||
if [ "$system_name" == "Darwin" ]; then
|
||||
sed -i '' '/bazel-cache/d' DEPS.bzl
|
||||
sed -i '' '/ats.apps.svc/d' DEPS.bzl
|
||||
sed -i '' '/bazel-cache/d' WORKSPACE
|
||||
sed -i '' '/ats.apps.svc/d' WORKSPACE
|
||||
elif [ "$system_name" == "Linux" ]; then
|
||||
sed -i '/bazel-cache/d' DEPS.bzl
|
||||
sed -i '/ats.apps.svc/d' DEPS.bzl
|
||||
sed -i '/bazel-cache/d' WORKSPACE
|
||||
sed -i '/ats.apps.svc/d' WORKSPACE
|
||||
fi
|
||||
make bazel_bin
|
||||
Reference in New Issue
Block a user