Skip to content

Commit

Permalink
Run Bazel build in Github Actions
Browse files Browse the repository at this point in the history
As some clients rely on the Bazel build, add a workflow to verify at
least one Bazel target (linux-x86). Also, perform some minor cleanup to
comments and target branches in our workflow files.
  • Loading branch information
prashanthswami committed Jan 8, 2024
1 parent 42bff7a commit ea2aa2a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
1 change: 0 additions & 1 deletion .bazelversion

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
pull_request:
push:
branches:
- master
- main

permissions:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/build_bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build using Bazel
on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
bazel-linux-local:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- name: Build
run: scripts/local-bazel-build.sh
17 changes: 17 additions & 0 deletions scripts/local-bazel-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -e

BAZEL_ARGS=()

# Bazel-level configuration
#
# If editing these flags, make sure `local-build.sh` flags are updated.
BAZEL_ARGS+=("-c=\"opt\"")
BAZEL_ARGS+=("-copt=\"fpic\"")

# User-specified Bazel arguments go last to allow overridding defaults
BAZEL_ARGS+=($@)

# Build all targets
bazel build :all
4 changes: 3 additions & 1 deletion scripts/local-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ mkdir -p build/local
CMAKE_ARGS=()

# CMake-level configuration
#
# If editing these flags, make sure `local-build-bazel.sh` flags are updated.
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Release")
CMAKE_ARGS+=("-DCMAKE_POSITION_INDEPENDENT_CODE=ON")

Expand All @@ -22,7 +24,7 @@ then
CMAKE_ARGS+=("-GNinja")
fi

# Use-specified CMake arguments go last to allow overridding defaults
# User-specified CMake arguments go last to allow overridding defaults
CMAKE_ARGS+=($@)

cd build/local && cmake ../.. \
Expand Down

0 comments on commit ea2aa2a

Please sign in to comment.