-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bazel support (with tests), add ability to cache downloads locall…
…y for increased iteration speed. (#19) * Add bazel support, optional local caching for downloads * lint * Try to fix secrets * Add bazel section to readme
- Loading branch information
1 parent
b92b312
commit 106ac22
Showing
13 changed files
with
372 additions
and
4 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,23 @@ | ||
try-import user.bazelrc | ||
try-import .buildbuddy-auth.rc | ||
|
||
test --test_output=errors | ||
|
||
# Build Buddy Cache Setup | ||
build:build_buddy --bes_results_url=https://app.buildbuddy.io/invocation/ | ||
build:build_buddy --bes_backend=grpcs://remote.buildbuddy.io | ||
build:build_buddy --remote_cache=grpcs://remote.buildbuddy.io | ||
build:build_buddy --remote_timeout=3600 | ||
|
||
# Additional suggestions from buildbuddy for speed | ||
build:build_buddy --experimental_remote_cache_compression | ||
build:build_buddy --experimental_remote_cache_compression_threshold=100 | ||
build:build_buddy --noslim_profile | ||
build:build_buddy --experimental_profile_include_target_label | ||
build:build_buddy --experimental_profile_include_primary_output | ||
build:build_buddy --nolegacy_important_outputs | ||
|
||
build:ci --config=build_buddy | ||
build:ci --remote_download_minimal | ||
build:ci --build_metadata=ROLE=CI | ||
build:ci --build_metadata=VISIBILITY=PUBLIC |
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 @@ | ||
7.2.0 |
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,35 @@ | ||
# This workflow runs the JSON checker on each vendordep JSON file. | ||
|
||
name: Bazel CI | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the main branch | ||
on: | ||
push: | ||
pull_request: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "run-json-checker" | ||
run-json-checker: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history so we can use git diff | ||
|
||
- name: Maybe setup BuildBuddy key | ||
env: | ||
API_KEY: ${{ secrets.API_KEY }} | ||
if: ${{ env.API_KEY != '' }} | ||
shell: bash | ||
run: | | ||
echo "API Key detected!" | ||
echo "build:build_buddy --remote_header=x-buildbuddy-api-key=${{ env.API_KEY }}" > .buildbuddy-auth.rc | ||
- name: Run check | ||
run: | | ||
bazel test //... -k --config=ci |
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,4 @@ | ||
*.sw? | ||
|
||
bazel-* | ||
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,39 @@ | ||
load("@rules_python//python:defs.bzl", "py_binary") | ||
load("@rules_python//python:pip.bzl", "compile_pip_requirements") | ||
load("@vendor-json-repo-pip//:requirements.bzl", "requirement") | ||
load("//:test_utils.bzl", "vendordep_check_test") | ||
|
||
# bazel run //:requirements.update | ||
compile_pip_requirements( | ||
name = "requirements", | ||
extra_args = ["--allow-unsafe"], | ||
requirements_in = "requirements.txt", | ||
requirements_txt = "requirements_lock.txt", | ||
) | ||
|
||
py_binary( | ||
name = "check", | ||
srcs = ["check.py"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
requirement("pyelftools"), | ||
requirement("pefile"), | ||
], | ||
) | ||
|
||
# Change this for local testing only. | ||
cache_directory = None | ||
|
||
[vendordep_check_test( | ||
allowable_errors = 1, | ||
allowable_warnings = None, | ||
cache_directory = cache_directory, | ||
vendor_file = f, | ||
) for f in glob(["2024/*.json"])] | ||
|
||
[vendordep_check_test( | ||
allowable_errors = 0, | ||
allowable_warnings = None, | ||
cache_directory = cache_directory, | ||
vendor_file = f, | ||
) for f in glob(["2025/*.json"])] |
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,25 @@ | ||
module( | ||
name = "vendor-json-repo", | ||
version = "", | ||
compatibility_level = 1, | ||
) | ||
|
||
bazel_dep(name = "rules_python", version = "0.37.0") | ||
|
||
python = use_extension("@rules_python//python/extensions:python.bzl", "python") | ||
python.toolchain( | ||
python_version = "3.10", | ||
) | ||
use_repo(python, "python_versions") | ||
|
||
register_toolchains( | ||
"@python_versions//:all", | ||
) | ||
|
||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") | ||
pip.parse( | ||
hub_name = "vendor-json-repo-pip", | ||
python_version = "3.10", | ||
requirements_lock = "//:requirements_lock.txt", | ||
) | ||
use_repo(pip, "vendor-json-repo-pip") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Empty file.
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
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 @@ | ||
pyelftools | ||
pefile |
Oops, something went wrong.