Skip to content

Commit

Permalink
chore: align ci patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed May 13, 2024
1 parent cc55d5c commit 9e0dd37
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 59 deletions.
1 change: 1 addition & 0 deletions .aspect/bazelrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
user.bazelrc
6 changes: 3 additions & 3 deletions .aspect/workflows/bazelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# build without the bytes
test --remote_download_minimal
test --nobuild_runfile_links
common --remote_download_outputs=minimal
common --nobuild_runfile_links

# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
test --test_env=XDG_CACHE_HOME
common --test_env=XDG_CACHE_HOME
6 changes: 0 additions & 6 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import %workspace%/.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC SETTINGS GO HERE ###

# Runfiles still required for Windows in this repository despite not
# being strictly necessary for rules_js support with
# https://github.com/aspect-build/rules_js/pull/1428 landed.
# TODO: fix broken targets on Windows and remove this flag
build --enable_runfiles

# Don’t want to push a rules author to update their deps if not needed.
# https://bazel.build/reference/command-line-reference#flag--check_direct_dependencies
# https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
common --disk_cache=~/.cache/bazel-disk-cache
common --repository_cache=~/.cache/bazel-repository-cache

# Bazel version specific settings
common:bazel6 --build_tag_filters=-skip-on-bazel6
common:bazel6 --test_tag_filters=-skip-on-bazel6
common:bazel7 --build_tag_filters=-skip-on-bazel7
common:bazel7 --test_tag_filters=-skip-on-bazel7
# Debug where options came from
common --announce_rc

# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
common --test_env=XDG_CACHE_HOME

# Runfiles still required for Windows in this repository despite not
# being strictly necessary for rules_js support with
# https://github.com/aspect-build/rules_js/pull/1428 landed.
# TODO: fix broken targets on Windows and remove this flag
build --enable_runfiles
common --enable_runfiles
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
~/.cache/bazel-disk-cache
~/.cache/bazel-repository-cache
~/.cache/xdg-cache
key: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel', 'MODULE.bazel.lock') }}
key: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel') }}
restore-keys: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-

- name: Configure Bazel version
Expand Down Expand Up @@ -119,7 +119,8 @@ jobs:
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/ci.bazelrc \
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/ci.bazelrc \
test \
--config=bazel${{ matrix.bazel-version.major }} \
--test_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \
--build_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \
--enable_bzlmod=${{ matrix.bzlmod }} \
//...
env:
Expand Down
21 changes: 12 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
bazel-*
**/.terraform/*
.bazelrc.user
node_modules/
.pnpm-*

.idea/
.ijwb/
node_modules
.vscode
.DS_Store

# Don't commit lockfile for now as it is unstable. Do allow for it to be
# created, however, since it gives a performance boost for local development.
# https://github.com/bazelbuild/bazel/issues/19026
# https://github.com/bazelbuild/bazel/issues/19621
# https://github.com/bazelbuild/bazel/issues/19971
# https://github.com/bazelbuild/bazel/issues/20272
# https://github.com/bazelbuild/bazel/issues/20369
# Bazel's MODULE lockfile isn't ready to check in yet as of Bazel 7.1.
# Do allow for it to be created, however, since it gives a performance boost for local development.
# [Store resolved repository attributes in the Bzlmod lockfile](https://github.com/bazelbuild/bazel/issues/19026)
# [MODULE.bazel.lock file contains user specific paths](https://github.com/bazelbuild/bazel/issues/19621)
# [Consider skipping bazel_tools@_ from lockfile](https://github.com/bazelbuild/bazel/issues/19971)
# [MODULE.bazel.lock file "reads through" already-locked package manager](https://github.com/bazelbuild/bazel/issues/20272)
# [moduleFileHash in MODULE.bazel.lock causes frequent Git merge conflicts](https://github.com/bazelbuild/bazel/issues/20369)
MODULE.bazel.lock
3 changes: 0 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ buildifier_prebuilt_register_toolchains()
load(
"@aspect_rules_lint//format:repositories.bzl",
"fetch_shfmt",
"fetch_terraform",
)

fetch_shfmt()

fetch_terraform()
15 changes: 15 additions & 0 deletions e2e/jasmine_test/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Import Aspect bazelrc presets
try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc
import %workspace%/../../.aspect/bazelrc/debug.bazelrc
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc
import %workspace%/../../.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc
2 changes: 1 addition & 1 deletion e2e/jasmine_test/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependenc
npm.npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "@aspect_rules_jasmine//:pnpm-lock.yaml",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm")
20 changes: 9 additions & 11 deletions e2e/jasmine_test/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions e2e/smoke/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# rules_js needs to create symlinks to build the runfiles tree.
# Creating symlinks on Windows requires one of the following:
# 1. Bazel is run with administrator privileges.
# 2. The system version is Windows 10 Creators Update (1703) or later
# and developer mode is enabled.
build --enable_runfiles
# Import Aspect bazelrc presets
try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc
import %workspace%/../../.aspect/bazelrc/debug.bazelrc
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc
import %workspace%/../../.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc
2 changes: 1 addition & 1 deletion e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependenc
npm.npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "@aspect_rules_jasmine//:pnpm-lock.yaml",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm")
11 changes: 0 additions & 11 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,8 @@ alias(
}),
)

alias(
name = "terraform",
actual = select({
"@bazel_tools//src/conditions:darwin_arm64": "@terraform_macos_aarch64//:terraform",
"@bazel_tools//src/conditions:darwin_x86_64": "@terraform_macos_x86_64//:terraform",
"@bazel_tools//src/conditions:linux": "@terraform_linux_x86_64//:terraform",
"//conditions:default": ":noop",
}),
)

multi_formatter_binary(
name = "format",
sh = ":shfmt",
starlark = "@buildifier_prebuilt//:buildifier",
terraform = ":terraform",
)

0 comments on commit 9e0dd37

Please sign in to comment.