diff --git a/.github/actions/tidb_build/action.yml b/.github/actions/tidb_build/action.yml new file mode 100644 index 0000000000..7bc3d36825 --- /dev/null +++ b/.github/actions/tidb_build/action.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/bazel-build-crossbuild.yml b/.github/workflows/bazel-build-crossbuild.yml new file mode 100644 index 0000000000..fa7272429e --- /dev/null +++ b/.github/workflows/bazel-build-crossbuild.yml @@ -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 \ No newline at end of file