Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Bazel build in Github Actions #213

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 18 additions & 0 deletions scripts/local-bazel-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Copyright 2024 Google LLC

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
Loading