Skip to content

Commit

Permalink
Auto generation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger committed May 7, 2023
1 parent 3fdada7 commit a5140d7
Show file tree
Hide file tree
Showing 37 changed files with 2,753 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
tests
generate
generate
6 changes: 5 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,32 @@ build:roborio --copt=-std=c++20
build:roborio --platforms=@rules_bzlmodrio_toolchains//platforms/roborio
build:roborio --build_tag_filters=-no-roborio
build:roborio --features=compiler_param_file
build:roborio --platform_suffix=roborio

# bullseye32
build:bullseye32 --copt=-std=c++20
build:bullseye32 --platforms=@rules_bzlmodrio_toolchains//platforms/bullseye32
build:bullseye32 --build_tag_filters=-no-bullseye
build:bullseye32 --features=compiler_param_file
build:bullseye32 --platform_suffix=bullseye32

# bullseye64
build:bullseye64 --copt=-std=c++20
build:bullseye64 --platforms=@rules_bzlmodrio_toolchains//platforms/bullseye64
build:bullseye64 --build_tag_filters=-no-bullseye
build:bullseye64 --features=compiler_param_file
build:bullseye64 --platform_suffix=bullseye64

# rasppi
build:raspi32 --copt=-std=c++20
build:raspi32 --platforms=@rules_bzlmodrio_toolchains//platforms/raspi32
build:raspi32 --build_tag_filters=-no-raspi
build:raspi32 --features=compiler_param_file
build:raspi32 --platform_suffix=raspi32

# Global
import .bazelrc-buildbuddy
test --test_output=errors
build --incompatible_enable_cc_toolchain_resolution
build --java_language_version=11
build --registry=https://raw.githubusercontent.com/pjreiniger/bazel-central-registry/megadiff/
build --registry=https://raw.githubusercontent.com/pjreiniger/bazel-central-registry/bzlmodrio/
2 changes: 1 addition & 1 deletion .bazelrc-buildbuddy
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ build:remote --remote_timeout=3600
build --experimental_inmemory_jdeps_files
build --experimental_inmemory_dotd_files

build:ci --build_metadata=ROLE=CI
build:ci --build_metadata=ROLE=CI
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.0.0
35 changes: 27 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Build example project
on: [pull_request, push]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
build_native:
strategy:
Expand All @@ -20,12 +25,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --verbose_failures --config=remote //... @rules_bzlmodrio_toolchains//...
- uses: actions/setup-python@v4
- run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --verbose_failures --config=remote //... @rules_bzlmodrio_toolchains//... || true
working-directory: tests
- run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote
working-directory: tests


build_roborio:
strategy:
fail-fast: false
Expand All @@ -35,7 +41,7 @@ jobs:
- { name: "windows - roborio", os: windows-latest, command: "build", config: "--config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - roborio", os: ubuntu-latest, command: "build", config: "--config=roborio", bazel_options: "", }
- { name: "macos - roborio", os: macos-latest, command: "build", config: "--config=roborio", bazel_options: "", }

# Build bzlmod, roborio
# - { name: "windows - bzlmod roborio", os: windows-latest, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod roborio", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=roborio", bazel_options: "", }
Expand All @@ -44,6 +50,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
working-directory: tests
- run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote
working-directory: tests

Expand All @@ -56,7 +66,7 @@ jobs:
- { name: "windows - bullseye32", os: windows-latest, command: "build", config: "--config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bullseye32", os: ubuntu-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }
# - { name: "macos - bullseye32", os: macos-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }

# Build bzlmod, bullseye32
# - { name: "windows - bzlmod bullseye32", os: windows-latest, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod bullseye32", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=bullseye32", bazel_options: "", }
Expand All @@ -65,6 +75,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
working-directory: tests
- run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote
working-directory: tests

Expand All @@ -78,7 +92,7 @@ jobs:
- { name: "windows - bullseye64", os: windows-latest, command: "build", config: "--config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bullseye64", os: ubuntu-latest, command: "build", config: "--config=bullseye64", bazel_options: "", }
# - { name: "macos - bullseye64", os: macos-latest, command: "build", config: "--config=bullseye32", bazel_options: "", }

# Build bzlmod, bullseye32:
# - { name: "windows - bzlmod bullseye64", os: windows-latest, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod bullseye64", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=bullseye64", bazel_options: "", }
Expand All @@ -87,10 +101,15 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around
run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true
working-directory: tests
- run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote
working-directory: tests




build_raspi32:
strategy:
fail-fast: false
Expand All @@ -100,7 +119,7 @@ jobs:
- { name: "windows - raspi32", os: windows-latest, command: "build", config: "--config=raspi32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - raspi32", os: ubuntu-latest, command: "build", config: "--config=raspi32", bazel_options: "", }
# - { name: "macos - raspi32", os: macos-latest, command: "build", config: "--config=raspi32", bazel_options: "", }

# Build bzlmod, bullseye32:
# - { name: "windows - bzlmod raspi32", os: windows-latest, command: "build", config: "--enable_bzlmod --config=raspi32", bazel_options: "--output_user_root=C:\\bazelroot", }
- { name: "ubuntu - bzlmod raspi32", os: ubuntu-latest, command: "build", config: "--enable_bzlmod --config=raspi32", bazel_options: "", }
Expand All @@ -110,4 +129,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote
working-directory: tests
working-directory: tests
25 changes: 24 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ jobs:
- uses: actions/checkout@v2
- uses: psf/black@stable
wpiformat:
name: "wpiformat"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Fetch main
run: |
git fetch origin main
git branch -f main origin/main
- uses: actions/setup-python@v2
with:
python-version: '3.10.8'
- name: Install clang-format
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-format-14
- run: bazel run @rules_wpiformat//wpiformat -- -f ..
working-directory: tests

- name: Check Output
run: git --no-pager diff --exit-code HEAD
buildifier:
name: "buildifier"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -39,4 +62,4 @@ jobs:
with:
name: buildifier fixes
path: buildifier-fixes.patch
if: ${{ failure() }}
if: ${{ failure() }}
79 changes: 79 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish Module
on:
workflow_dispatch:
push:
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
publish_module:
name: "Publish Module"
runs-on: ubuntu-latest
steps:
# Checkout repository
- uses: actions/checkout@v3
with:
path: rules/rules_bzlmodrio_toolchains

- name: Create Archive
run: git archive HEAD --format=tar.gz --output="rules_bzlmodrio_toolchains-${GITHUB_REF_NAME}.tar.gz"
working-directory: rules/rules_bzlmodrio_toolchains

- name: Setup archive name
run: echo "ARCHIVE_NAME=rules/rules_bzlmodrio_toolchains/rules_bzlmodrio_toolchains-${GITHUB_REF_NAME}.tar.gz" >> "$GITHUB_ENV"

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: "${{ env.ARCHIVE_NAME }}"


# Checkout gentool
- uses: actions/checkout@v3
with:
repository: 'bzlmodRio/gentool.git'
fetch-depth: 0
path: gentool
ref: refactor_dev

# Checkout BCR
- uses: actions/checkout@v3
with:
repository: 'bzlmodRio/bazel-central-registry.git'
fetch-depth: 0
path: bazel-central-registry
ref: bzlmodrio

# Run publishing
- run: bazel run //:publish
working-directory: rules/rules_bzlmodrio_toolchains/generate

# Create pull requests
- name: Create Gentool Pull Request
uses: peter-evans/create-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.AUTO_UPDATE_KEY }}
with:
path: gentool
base: refactor_dev
token: ${{ secrets.AUTO_UPDATE_KEY }}
reviewers: pjreiniger
branch: autoupdate/rules_bzlmodrio_toolchains_update
title: "Auto-update latest rules_bzlmodrio_toolchains module release"

- name: Create BCR Pull Request
uses: peter-evans/create-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.AUTO_UPDATE_KEY }}
with:
path: bazel-central-registry
base: bzlmodrio
token: ${{ secrets.AUTO_UPDATE_KEY }}
reviewers: pjreiniger
branch: autoupdate/rules_wpi_styleguid_update
title: "Auto-update latest rules_bzlmodrio_toolchains module release"
32 changes: 32 additions & 0 deletions .styleguide
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cppHeaderFileInclude {
\.h$
\.hpp$
\.inc$
\.inl$
}

licenseUpdateExclude {
/
}

cppSrcFileInclude {
\.cpp$
}

modifiableFileExclude {
}

generatedFileExclude {
bazel-bin/
bazel-out/
bazel-testlogs/
bazel-tests
BUILD.bazel
jni/arm-linux-jni/
}

repoRootNameOverride {
}

includeOtherLibs {
}
1 change: 1 addition & 0 deletions .styleguide-license
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module(

bazel_dep(name = "platforms", version = "0.0.6")
bazel_dep(name = "rules_cc", version = "0.0.4")
bazel_dep(name = "bazel_skylib", version = "1.4.1")

deps = use_extension("//:maven_deps.bzl", "deps")
use_repo(
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

11 changes: 11 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
workspace(name = "rules_bzlmodrio_toolchains")

load("@rules_bzlmodrio_toolchains//:maven_deps.bzl", "setup_legacy_setup_toolchains_dependencies")

setup_legacy_setup_toolchains_dependencies()
Expand All @@ -20,3 +22,12 @@ register_toolchains(
"@local_roborio//:linux",
"@local_roborio//:windows",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazel_skylib",
sha256 = "060426b186670beede4104095324a72bd7494d8b4e785bf0d84a612978285908",
strip_prefix = "bazel-skylib-1.4.1",
url = "https://github.com/bazelbuild/bazel-skylib/archive/refs/tags/1.4.1.tar.gz",
)
1 change: 1 addition & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

28 changes: 28 additions & 0 deletions constraints/combined/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
load("@bazel_skylib//lib:selects.bzl", "selects")

selects.config_setting_group(
name = "is_cross_compiler",
match_any = [
"//constraints/is_roborio:roborio",
"//constraints/is_bullseye32:bullseye32",
"//constraints/is_bullseye64:bullseye64",
"//constraints/is_raspi32:raspi32",
],
)

selects.config_setting_group(
name = "is_unix",
match_any = [
":is_cross_compiler",
"@bazel_tools//src/conditions:darwin",
"@bazel_tools//src/conditions:linux_x86_64",
],
)

selects.config_setting_group(
name = "is_linux",
match_any = [
":is_cross_compiler",
"@bazel_tools//src/conditions:linux_x86_64",
],
)
2 changes: 1 addition & 1 deletion generate/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ http_archive(

local_repository(
name = "bzlmodrio-gentool",
path = "../../gentool",
path = "../../../gentool",
)

load("@rules_python//python:pip.bzl", "pip_parse")
Expand Down
Loading

0 comments on commit a5140d7

Please sign in to comment.