Skip to content

Commit

Permalink
chore: bzlmod (#47)
Browse files Browse the repository at this point in the history
* chore: bzlmod

Fixes #46

* green up bzlmod
  • Loading branch information
alexeagle authored Apr 1, 2023
1 parent 829d278 commit fb4b2cb
Show file tree
Hide file tree
Showing 22 changed files with 99 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .bcr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Bazel Central Registry

When the ruleset is released, we want it to be published to the
Bazel Central Registry automatically:
<https://registry.bazel.build>

This folder contains configuration files to automate the publish step.
See <https://github.com/bazel-contrib/publish-to-bcr/blob/main/templates/README.md>
for authoritative documentation about these files.
4 changes: 4 additions & 0 deletions .bcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# See https://github.com/bazel-contrib/publish-to-bcr#a-note-on-release-automation
fixedReleaser:
login: alexeagle
email: [email protected]
13 changes: 13 additions & 0 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"homepage": "https://docs.aspect.build/rules/aspect_rules_jasmine",
"maintainers": [
{
"email": "[email protected]",
"github": "aspect-build",
"name": "Aspect team"
}
],
"repository": ["github:aspect-build/rules_jasmine"],
"versions": [],
"yanked_versions": {}
}
10 changes: 10 additions & 0 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
bcr_test_module:
module_path: 'e2e/smoke'
matrix:
platform: ['debian10', 'macos', 'ubuntu2004', 'windows']
tasks:
run_tests:
name: 'Run test module'
platform: ${{ platform }}
test_targets:
- '//...'
5 changes: 5 additions & 0 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "{REPO}-{VERSION}",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_jasmine-{TAG}.tar.gz"
}
15 changes: 13 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,19 @@ jobs:
matrix:
os: ${{ fromJSON(needs.matrix-prep-os.outputs.os) }}
bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }}
bzlmodEnabled: [true, false]
folder:
- "."
- "e2e/jasmine_test"
- "e2e/workspace"
- "e2e/smoke"
exclude:
# Don't test macos with Bazel 5 to minimize macOS minutes (billed at 10X)
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
- os: macos-latest
bazelversion: 5.3.2
# Don't test bzlmod with Bazel 5 (not supported)
- bazelversion: 5.3.2
bzlmodEnabled: true

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -102,9 +106,16 @@ jobs:
# then use .bazelversion to determine which Bazel version to use
run: echo "${{ matrix.bazelversion }}" > .bazelversion

- name: Set bzlmod flag
# Store the --enable_bzlmod flag that we add to the test command below
# only when we're running bzlmod in our test matrix.
id: set_bzlmod_flag
if: matrix.bzlmodEnabled
run: echo "bzlmod_flag=--enable_bzlmod" >> $GITHUB_OUTPUT

- name: bazel test //...
env:
# Bazelisk will download bazel to here, ensure it is cached between runs.
XDG_CACHE_HOME: ~/.cache/bazel-repo
working-directory: ${{ matrix.folder }}
run: bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
run: bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc test ${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }} //...
2 changes: 1 addition & 1 deletion .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ http_archive(
)
EOF

awk 'f;/--SNIP--/{f=1}' e2e/workspace/WORKSPACE
awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel
echo "\`\`\`"
15 changes: 15 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"aspect-build/rules_jasmine"

module(
name = "aspect_rules_jasmine",
compatibility_level = 1,
version = "0.0.0",
)

bazel_dep(name = "aspect_bazel_lib", version = "1.30.2")
bazel_dep(name = "aspect_rules_js", version = "1.23.2")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_nodejs", version = "5.8.2")

bazel_dep(name = "gazelle", version = "0.29.0", repo_name = "bazel_gazelle", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
From the release you wish to use:
<https://github.com/aspect-build/rules_jasmine/releases>
copy the WORKSPACE snippet into your `WORKSPACE` file.

## Usage
See the [API documentation](./docs/rules), and the example usages in the [`examples/`](https://github.com/aspect-build/rules_jasmine/tree/main/examples/) directory.
Note that the examples rely on code in the `/WORKSPACE` file in the root of this repo.
1 change: 1 addition & 0 deletions e2e/jasmine_test/MODULE.bazel
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"Bazel dependencies"
bazel_dep(name = "aspect_rules_jasmine", dev_dependency = True, version = "0.0.0")
bazel_dep(name = "aspect_rules_js", version = "1.23.2")

local_path_override(
module_name = "aspect_rules_jasmine",
path = "../..",
)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")

npm.npm_translate_lock(
name = "npm",
pnpm_lock = "@aspect_rules_jasmine//:pnpm-lock.yaml",
)

use_repo(npm, "npm")
4 changes: 4 additions & 0 deletions e2e/smoke/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# smoke test

This e2e exercises the repo from an end-users perpective.
It catches mistakes in our install instructions, or usages that fail when called from an "external" repository to rules_jasmine.
File renamed without changes.
3 changes: 3 additions & 0 deletions e2e/smoke/WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Marker file that this is the root of a Bazel workspace.
# This file replaces WORKSPACE.bazel under --enable_bzlmod.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit fb4b2cb

Please sign in to comment.