-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d15a51
commit 17382a3
Showing
77 changed files
with
2,972 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
############################################################################### | ||
## Bazel Configuration Flags | ||
## | ||
## `.bazelrc` is a Bazel configuration file. | ||
## https://bazel.build/docs/best-practices#bazelrc-file | ||
############################################################################### | ||
|
||
# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config | ||
common --enable_platform_specific_config | ||
|
||
# Enable the only currently supported report type | ||
# https://bazel.build/reference/command-line-reference#flag--combined_report | ||
coverage --combined_report=lcov | ||
|
||
# Avoid fully cached builds reporting no coverage and failing CI | ||
# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs | ||
coverage --experimental_fetch_all_coverage_outputs | ||
|
||
############################################################################### | ||
## Incompatibility flags | ||
############################################################################### | ||
|
||
# https://github.com/bazelbuild/bazel/issues/8195 | ||
build --incompatible_disallow_empty_glob=true | ||
|
||
# https://github.com/bazelbuild/bazel/issues/12821 | ||
build --nolegacy_external_runfiles | ||
|
||
# Required for cargo_build_script support before Bazel 7 | ||
build --incompatible_merge_fixed_and_default_shell_env | ||
|
||
# Disable legacy __init__.py behavior which is known to conflict with | ||
# modern python versions (3.9+) | ||
build --incompatible_default_to_explicit_init_py | ||
|
||
############################################################################### | ||
## Bzlmod | ||
############################################################################### | ||
|
||
# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel | ||
# https://github.com/bazelbuild/rules_rust/issues/2181 | ||
common --noenable_bzlmod | ||
|
||
# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock | ||
common --lockfile_mode=off | ||
|
||
############################################################################### | ||
## Custom user flags | ||
## | ||
## This should always be the last thing in the `.bazelrc` file to ensure | ||
## consistent behavior when setting flags in that file as `.bazelrc` files are | ||
## evaluated top to bottom. | ||
############################################################################### | ||
|
||
try-import %workspace%/user.bazelrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Bazel settings for use in Github CI | ||
|
||
# Always display the flags being used | ||
common --announce_rc | ||
|
||
# Show errors in CI | ||
test --test_output=errors | ||
|
||
# Show more information about failures | ||
build --verbose_failures | ||
|
||
# UI for cleaner CI output | ||
common --color=no | ||
common --show_timestamps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# {version} | ||
|
||
```python | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "rules_req_compile", | ||
sha256 = "{sha256}", | ||
urls = ["https://github.com/sputt/req-compile/releases/download/{version}/rules_req_compile-v{version}.tar.gz"], | ||
) | ||
``` | ||
|
||
Additional documentation can be found at: https://github.com/sputt/req-compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
--- | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
env: | ||
BAZEL_STARTUP_FLAGS: --bazelrc=${{ github.workspace }}/.github/github.bazelrc | ||
|
||
jobs: | ||
# ci: | ||
# runs-on: ${{ matrix.os }} | ||
# strategy: | ||
# matrix: | ||
# include: | ||
# - os: macos-11 | ||
# - os: ubuntu-20.04 | ||
# - os: windows-2019 | ||
# steps: | ||
# # Checkout the code | ||
# - uses: actions/checkout@v2 | ||
|
||
# # Caches and restores the Bazel outputs. | ||
# - name: Retain Bazel cache (linux) | ||
# uses: actions/cache@v2 | ||
# env: | ||
# cache-name: bazel-cache | ||
# with: | ||
# path: | | ||
# ~/.cache/bazelisk | ||
# ~/.cache/bazel | ||
# key: ${{ runner.os }}-${{ env.cache-name }} | ||
# if: startswith(runner.os, 'Linux') | ||
# - name: Retain Bazel cache (MacOS) | ||
# uses: actions/cache@v2 | ||
# env: | ||
# cache-name: bazel-cache | ||
# with: | ||
# path: | | ||
# ~/.cache/bazelisk | ||
# /private/var/tmp/_bazel_runner | ||
# key: ${{ runner.os }}-${{ env.cache-name }} | ||
# if: startswith(runner.os, 'MacOS') | ||
# - name: Retain Bazel cache (Windows) | ||
# uses: actions/cache@v2 | ||
# env: | ||
# cache-name: bazel-cache | ||
# with: | ||
# path: | | ||
# ~/.cache/bazelisk | ||
# C:/bzl | ||
# key: ${{ runner.os }}-${{ env.cache-name }} | ||
# if: startswith(runner.os, 'Windows') | ||
|
||
# - name: Setup Bazelrc (Windows) | ||
# run: | | ||
# echo "startup --output_user_root=C:/bzl" > ./user.bazelrc | ||
# if: startswith(runner.os, 'Windows') | ||
# - name: Setup Bazelrc | ||
# run: | | ||
# echo "common --noenable_bzlmod" >> ./user.bazelrc | ||
# echo "common --keep_going" >> ./user.bazelrc | ||
|
||
# # Build and Test the code | ||
# - name: Test (Unix) | ||
# run: bazel ${BAZEL_STARTUP_FLAGS[@]} test //... | ||
# if: startswith(runner.os, 'Windows') != true | ||
# - name: Test (Windows) | ||
# run: bazel $env:BAZEL_STARTUP_FLAGS test //... | ||
# if: startswith(runner.os, 'Windows') | ||
|
||
ci-buildifier: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
# Checkout the code | ||
- uses: actions/checkout@v2 | ||
- name: Download Buildifier | ||
run: | | ||
wget "https://github.com/bazelbuild/buildtools/releases/download/v7.1.2/buildifier-linux-amd64" -O buildifier | ||
chmod +x buildifier | ||
- name: Buildifier | ||
run: ./buildifier -lint=warn -mode=check -warnings=all -r ${{ github.workspace }} | ||
|
||
ci-lint-and-format: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
# Checkout the code | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.11 | ||
- name: Setup pip | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
- name: Install dependencies | ||
run: | | ||
pip install -r python/pytest/requirements.linux.txt --user | ||
- name: Run mypy | ||
run: | | ||
python -m mypy python | ||
- name: Run pylint | ||
run: | | ||
PYTHONPATH="$(pwd)" python -m pylint python | ||
- name: Run black | ||
run: | | ||
python -m black --check --diff python | ||
- name: Run isort | ||
run: | | ||
python -m isort --check-only python | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
env: | ||
BAZEL_STARTUP_FLAGS: --bazelrc=${{ github.workspace }}/.github/github.bazelrc | ||
|
||
jobs: | ||
# ci: | ||
# runs-on: ${{ matrix.os }} | ||
# strategy: | ||
# matrix: | ||
# include: | ||
# - os: macos-11 | ||
# - os: ubuntu-20.04 | ||
# - os: windows-2019 | ||
# steps: | ||
# # Checkout the code | ||
# - uses: actions/checkout@v2 | ||
|
||
# # Caches and restores the Bazel outputs. | ||
# - name: Retain Bazel cache (linux) | ||
# uses: actions/cache@v2 | ||
# env: | ||
# cache-name: bazel-cache | ||
# with: | ||
# path: | | ||
# ~/.cache/bazelisk | ||
# ~/.cache/bazel | ||
# key: ${{ runner.os }}-${{ env.cache-name }} | ||
# if: startswith(runner.os, 'Linux') | ||
# - name: Retain Bazel cache (MacOS) | ||
# uses: actions/cache@v2 | ||
# env: | ||
# cache-name: bazel-cache | ||
# with: | ||
# path: | | ||
# ~/.cache/bazelisk | ||
# /private/var/tmp/_bazel_runner | ||
# key: ${{ runner.os }}-${{ env.cache-name }} | ||
# if: startswith(runner.os, 'MacOS') | ||
# - name: Retain Bazel cache (Windows) | ||
# uses: actions/cache@v2 | ||
# env: | ||
# cache-name: bazel-cache | ||
# with: | ||
# path: | | ||
# ~/.cache/bazelisk | ||
# C:/bzl | ||
# key: ${{ runner.os }}-${{ env.cache-name }} | ||
# if: startswith(runner.os, 'Windows') | ||
|
||
# - name: Setup Bazelrc (Windows) | ||
# run: | | ||
# echo "startup --output_user_root=C:/bzl" > ./user.bazelrc | ||
# if: startswith(runner.os, 'Windows') | ||
# - name: Setup Bazelrc | ||
# run: | | ||
# echo "common --noenable_bzlmod" >> ./user.bazelrc | ||
# echo "common --keep_going" >> ./user.bazelrc | ||
|
||
# # Build and Test the code | ||
# - name: Test (Unix) | ||
# run: bazel ${BAZEL_STARTUP_FLAGS[@]} test //... | ||
# if: startswith(runner.os, 'Windows') != true | ||
# - name: Test (Windows) | ||
# run: bazel $env:BAZEL_STARTUP_FLAGS test //... | ||
# if: startswith(runner.os, 'Windows') | ||
|
||
ci-buildifier: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
# Checkout the code | ||
- uses: actions/checkout@v2 | ||
- name: Download Buildifier | ||
run: | | ||
wget "https://github.com/bazelbuild/buildtools/releases/download/v7.1.2/buildifier-linux-amd64" -O buildifier | ||
chmod +x buildifier | ||
- name: Buildifier | ||
run: ./buildifier -lint=warn -mode=check -warnings=all -r ${{ github.workspace }} | ||
|
||
ci-lint: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
# Checkout the code | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.11 | ||
- name: Setup pip | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
- name: Install dependencies | ||
run: | | ||
pip install -r python/pytest/requirements.linux.txt --user | ||
- name: Run mypy | ||
run: | | ||
python -m mypy python | ||
- name: Run pylint | ||
run: | | ||
python -m pylint python | ||
- name: Run black | ||
run: | | ||
black --check --diff python | ||
- name: Run isort | ||
run: | | ||
isort --check-only python | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
# Git ignore patterns | ||
|
||
/bazel-* | ||
user.bazelrc | ||
|
||
/.venv* | ||
/venv* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[settings] | ||
profile = black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# https://mypy.readthedocs.io/en/stable/config_file.html | ||
[mypy] | ||
|
||
# Improve strictness of checks | ||
strict = True | ||
|
||
# Avoid deprecated args in the config file | ||
warn_unused_configs = True | ||
|
||
# Improve logging | ||
pretty = True | ||
|
||
# Prevent mypy from incorrectly looking in multiple places for | ||
# the same package. | ||
explicit_package_bases = True | ||
|
||
# Because mypy is not running in Bazel, the runfiles library will | ||
# not be available | ||
[mypy-python.runfiles.*] | ||
ignore_missing_imports = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exports_files(["README.md"]) |
Oops, something went wrong.