Skip to content

[build] consolidate nightly workflow #19847

[build] consolidate nightly workflow

[build] consolidate nightly workflow #19847

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- trunk
schedule:
- cron: "0 */12 * * *"
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-index:
name: Build Index
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/ci-build-index.yml
check:
name: Check Targets
if: >
github.event.repository.fork == false &&
(startsWith(github.head_ref, 'renovate/') != true || github.event_name == 'workflow_call')
uses: ./.github/workflows/bazel.yml
with:
name: Check Targets
cache-name: bazel-test-target-index
run: |
if [ "${{ github.event_name }}" == "schedule" ] || \
[ "${{ github.event_name }}" == "workflow_call" ] || \
[ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "Running all targets for ${{ github.event_name }} event"
echo "//java/... //py:all //rb/... //dotnet/... //rust/..." > bazel-targets.txt
else
BASE_SHA="${{ github.event.pull_request.base.sha || github.event.before }}"
if [ -n "$BASE_SHA" ]; then
./go bazel:affected_targets "${BASE_SHA}..HEAD" bazel-test-target-index
else
./go bazel:affected_targets bazel-test-target-index
fi
fi
artifact-name: check-targets
artifact-path: bazel-targets.txt
read-targets:
name: Read Targets
needs: check
runs-on: ubuntu-latest
outputs:
java: ${{ steps.read.outputs.java }}
py: ${{ steps.read.outputs.py }}
rb: ${{ steps.read.outputs.rb }}
dotnet: ${{ steps.read.outputs.dotnet }}
rust: ${{ steps.read.outputs.rust }}
steps:
- name: Download targets
uses: actions/download-artifact@v4
with:
name: check-targets
- name: Read targets
id: read
env:
COMMIT_MESSAGES: ${{ join(github.event.commits.*.message, ' ') }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
targets=$(cat bazel-targets.txt 2>/dev/null || echo "")
check_binding() {
local pattern=$1 tag=$2
if [[ "$targets" == *"$pattern"* ]] || [[ "$COMMIT_MESSAGES" == *"[$tag]"* ]] || [[ "$PR_TITLE" == *"[$tag]"* ]]; then
echo "$tag=true" >> "$GITHUB_OUTPUT"
fi
}
check_binding "//java/" "java"
check_binding "//py:" "py"
check_binding "//rb/" "rb"
check_binding "//dotnet/" "dotnet"
check_binding "//rust/" "rust"
dotnet:
name: .NET
needs: read-targets
uses: ./.github/workflows/ci-dotnet.yml
if: needs.read-targets.outputs.dotnet != ''
java:
name: Java
needs: read-targets
uses: ./.github/workflows/ci-java.yml
if: needs.read-targets.outputs.java != ''
python:
name: Python
needs: read-targets
uses: ./.github/workflows/ci-python.yml
if: needs.read-targets.outputs.py != ''
ruby:
name: Ruby
needs: read-targets
uses: ./.github/workflows/ci-ruby.yml
if: needs.read-targets.outputs.rb != ''
rust:
name: Rust
needs: read-targets
uses: ./.github/workflows/ci-rust.yml
secrets:
SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
if: needs.read-targets.outputs.rust != ''