Skip to content

Squash

Squash #73

Workflow file for this run

name: Bazel
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build-native:
strategy:
fail-fast: false
matrix:
include:
- { os: windows-2022, action: "test", config: "--config=windows", wpimath_config: "--local_cpu_resources=1" }
# - { os: windows-2022, action: "test", config: "--config=windows --enable_bzlmod", wpimath_config: "--local_cpu_resources=1" }
# - { os: windows-2022, config: "--config=roborio" }
# - { os: windows-2022, config: "--config=bionic" }
# - { os: windows-2022, config: "--config=raspbian" }
- { os: macos-latest, action: "test", config: "--config=osx -c opt --config=no_example", wpimath_config: "" }
# - { os: macos-latest, action: "test", config: "--config=osx -c opt --config=no_example --enable_bzlmod", wpimath_config: "" }
# - { os: macos-latest, config: "--config=roborio" }
# - { os: macos-latest, config: "--config=bionic" }
# - { os: macos-latest, config: "--config=raspbian" }
#
# - { os: ubuntu-latest, config: "--config=roborio" }
# - { os: ubuntu-latest, config: "--config=bionic" }
# - { os: ubuntu-latest, config: "--config=raspbian" }
name: "Build - ${{ matrix.os }} ${{ matrix.config }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: bazelbuild/setup-bazelisk@v1
- name: Build wpimath dependencies
run: bazel ${{ matrix.action }} -k wpiutil/... --config=remote ${{ matrix.config }} --nojava_header_compilation --verbose_failures --test_verbose_timeout_warnings
shell: bash
- name: Build wpimath
run: bazel build -k wpimath/... --config=remote ${{ matrix.config }} ${{ matrix.wpimath_config }} --nojava_header_compilation --verbose_failures
shell: bash
- name: Build
run: bazel ${{ matrix.action }} -k ... --config=remote ${{ matrix.config }} --nojava_header_compilation --verbose_failures --test_verbose_timeout_warnings
shell: bash
build-linux:
strategy:
fail-fast: false
matrix:
include:
- { container: "wpilib/ubuntu-base:22.04", artifact-name: "Linux Release", config: "" }
runs-on: ubuntu-latest
name: "Build - ${{ matrix.artifact-name }}${{ matrix.architecture }} ${{ matrix.config }}"
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- uses: bazelbuild/setup-bazelisk@v1
- name: Build and Test
run: bazel test ... --config=remote --config=linux ${{ matrix.config }} -k --verbose_failures --test_verbose_timeout_warnings
repin-maven:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel run @unpinned_maven//:pin
- run: git diff HEAD
- uses: actions/upload-artifact@v2
with:
name: Re-pinned maven
path: shared/bazel/deps/maven_install.json
build-sanitizers:
strategy:
fail-fast: false
matrix:
include:
- config: "tsan"
- config: "asan"
- config: "ubsan"
runs-on: ubuntu-latest
container: wpilib/ubuntu-base:22.04
name: "Sanitizer ${{ matrix.config }}"
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- uses: bazelbuild/setup-bazelisk@v1
- name: Build and Test
run: bazel test -k --config=remote --config=linux --config=${{ matrix.config }} --test_verbose_timeout_warnings //...
build-coverage:
runs-on: ubuntu-22.04
name: "Code Coverage"
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- uses: bazelbuild/setup-bazelisk@v1
- name: Install LCOV
run: sudo apt-get install -y lcov
- name: Build, allow buildbudy failure
run: bazel coverage --config=remote --config=linux -k -- //... -//simulation/halsim_gui/src/test/native/cpp:halsim_gui-test
- name: genhtml
run: |
genhtml bazel-out/_coverage/_coverage_report.dat -o coverage_report/combined
- uses: actions/upload-artifact@v2
with:
name: "Coverage"
path: coverage_report
buildifier:
name: "buildifier"
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.15.x
uses: actions/setup-go@v2
with:
go-version: 1.15.x
id: go
- name: Install Buildifier
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/buildifier@6.0.0
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- name: Run buildifier
run: buildifier -warnings all --lint=fix -r .
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > bazel-lint-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.platform }}-bazel-lint-fixes
path: bazel-lint-fixes.patch
if: ${{ failure() }}
unused_deps:
name: "unused_deps"
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.15.x
uses: actions/setup-go@v2
with:
go-version: 1.15.x
id: go
- uses: actions/checkout@v3
- name: Install Unused Deps
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/unused_deps@5.1.0
- name: Install Buildozer
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/buildozer@5.1.0
- name: Dump Platform Flag
run: |
echo "# Flags for unused deps" > user.bazelrc
echo "build --config=linux" >> user.bazelrc
echo "build --config=remote" >> user.bazelrc
echo "build --build_tag_filters=-wpi-cpp-gui" >> user.bazelrc
echo "build --test_tag_filters=-wpi-cpp-gui" >> user.bazelrc
- name: Debug userrc
run: cat user.bazelrc
- name: Prep unused deps
run: bazel query --tool_tag=unused_deps --keep_going "kind('(kt|java|android)_*', //...)" || true
- name: Run unused deps
run: unused_deps -cquery //... > buildozer-cmds.sh
- name: Show unused deps
run: cat buildozer-cmds.sh
- uses: actions/upload-artifact@v2
with:
name: Upload Unused Deps Script
path: buildozer-cmds.sh
- name: Fix unused deps
run: chmod +x buildozer-cmds.sh && ./buildozer-cmds.sh
- name: Generate diff
run: git diff > bazel-unused-deps-fixes.patch
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- uses: actions/upload-artifact@v2
with:
name: Upload Unused Deps Patch
path: bazel-unused-deps-fixes.patch
if: ${{ failure() }}