Skip to content

Commit 7ecf366

Browse files
committed
build: more setup
1 parent 0f28eac commit 7ecf366

19 files changed

Lines changed: 227 additions & 91 deletions

.bazelignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
e2e/
1+
# Examples and e2e tests have their own MODULE.bazel files and are tested separately in CI
2+
# The REPO.bazel files mark them as separate repos, but we also need .bazelignore
3+
# to prevent //... from traversing into them
4+
examples
5+
e2e

.bcr/metadata.template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"homepage": "https://github.com/myorg/rules_mylang",
2+
"homepage": "https://github.com/formatjs/rules_formatjs",
33
"maintainers": [],
4-
"repository": ["github:myorg/rules_mylang"],
4+
"repository": ["github:formatjs/rules_formatjs"],
55
"versions": [],
66
"yanked_versions": {}
77
}

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ examples export-ignore
88

99
# Occasionally there's a need to "stamp" the release version into a file
1010
# See https://blog.aspect.build/releasing-bazel-rulesets-rust for details if you need this.
11-
# mylang/version.bzl export-subst
11+
# formatjs/version.bzl export-subst

.github/workflows/buildifier.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v5
16+
- uses: bazel-contrib/setup-bazel@0.16.0
17+
with:
18+
bazelisk-cache: true
1619
- name: buildifier
1720
run: bazel run --enable_bzlmod //.github/workflows:buildifier.check

.github/workflows/ci.yaml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
11
name: CI
2-
# Controls when the action will run.
32
on:
4-
# Triggers the workflow on push or pull request events but only for the main branch
53
push:
64
branches: [main]
75
pull_request:
86
branches: [main]
9-
# Allows you to run this workflow manually from the Actions tab
107
workflow_dispatch:
118
concurrency:
12-
# Cancel previous actions from the same PR or branch except 'main' branch.
13-
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
14-
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1510
cancel-in-progress: ${{ github.ref_name != 'main' }}
1611
jobs:
1712
test:
18-
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v6
19-
with:
20-
folders: |
21-
[
22-
".",
23-
"e2e/smoke"
24-
]
25-
exclude: |
26-
[
27-
{"folder": ".", "bzlmodEnabled": false},
28-
{"folder": ".", "bazelVersion": "6.4.0"}
29-
]
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest]
17+
folder:
18+
- "."
19+
- "e2e/smoke"
20+
- "examples/simple"
21+
- "examples/aggregate"
22+
runs-on: ${{ matrix.os }}
23+
steps:
24+
- uses: actions/checkout@v5
25+
- uses: bazel-contrib/setup-bazel@0.16.0
26+
with:
27+
bazelisk-cache: true
28+
- name: Test ${{ matrix.folder }}
29+
working-directory: ${{ matrix.folder }}
30+
run: bazel test //...
31+
3032
pre-commit:
3133
runs-on: ubuntu-latest
3234
steps:
3335
- uses: actions/checkout@v5
3436
- uses: pre-commit/action@v3.0.1
35-
# For branch protection settings, this job provides a "stable" name that can be used to gate PR merges
36-
# on "all matrix jobs were successful".
37+
3738
conclusion:
3839
needs: [test, pre-commit]
3940
runs-on: ubuntu-latest
4041
if: always()
4142
steps:
4243
- uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3
43-
# Note: possible conclusion values:
44-
# https://github.com/technote-space/workflow-conclusion-action/blob/main/src/constant.ts
45-
- name: report success
44+
- name: Report success
4645
if: ${{ env.WORKFLOW_CONCLUSION == 'success' }}
47-
working-directory: /tmp
48-
run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 0
49-
- name: report failure
46+
run: exit 0
47+
- name: Report failure
5048
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }}
51-
working-directory: /tmp
52-
run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 1
49+
run: exit 1

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
release:
2323
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.2.2
2424
with:
25-
release_files: rules_mylang-*.tar.gz
25+
release_files: rules_formatjs-*.tar.gz
2626
prerelease: false
2727
tag_name: ${{ inputs.tag_name || github.ref_name }}
2828
publish:

.github/workflows/release_prep.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ TAG=$1
88
# The prefix is chosen to match what GitHub generates for source archives
99
# This guarantees that users can easily switch from a released artifact to a source archive
1010
# with minimal differences in their code (e.g. strip_prefix remains the same)
11-
PREFIX="rules_mylang-${TAG:1}"
12-
ARCHIVE="rules_mylang-$TAG.tar.gz"
11+
PREFIX="rules_formatjs-${TAG:1}"
12+
ARCHIVE="rules_formatjs-$TAG.tar.gz"
1313

1414
# NB: configuration for 'git archive' is in /.gitattributes
1515
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
@@ -30,7 +30,7 @@ cat << EOF
3030
2. Add to your \`MODULE.bazel\` file:
3131
3232
\`\`\`starlark
33-
bazel_dep(name = "com_myorg_rules_mylang", version = "${TAG:1}")
33+
bazel_dep(name = "rules_formatjs", version = "${TAG:1}")
3434
\`\`\`
3535
3636
## Using WORKSPACE
@@ -40,10 +40,10 @@ Paste this snippet into your \`WORKSPACE.bazel\` file:
4040
\`\`\`starlark
4141
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4242
http_archive(
43-
name = "com_myorg_rules_mylang",
43+
name = "rules_formatjs",
4444
sha256 = "${SHA}",
4545
strip_prefix = "${PREFIX}",
46-
url = "https://github.com/myorg/rules_mylang/releases/download/${TAG}/${ARCHIVE}",
46+
url = "https://github.com/formatjs/rules_formatjs/releases/download/${TAG}/${ARCHIVE}",
4747
)
4848
EOF
4949

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ Run `bazel run //:gazelle` to keep them up-to-date.
2828
## Using this as a development dependency of other rules
2929

3030
You'll commonly find that you develop in another WORKSPACE, such as
31-
some other ruleset that depends on rules_mylang, or in a nested
31+
some other ruleset that depends on rules_formatjs, or in a nested
3232
WORKSPACE in the integration_tests folder.
3333

3434
To always tell Bazel to use this directory rather than some release
3535
artifact or a version fetched from the internet, run this from this
3636
directory:
3737

3838
```sh
39-
OVERRIDE="--override_repository=rules_mylang=$(pwd)/rules_mylang"
39+
OVERRIDE="--override_repository=rules_formatjs=$(pwd)"
4040
echo "common $OVERRIDE" >> ~/.bazelrc
4141
```
4242

43-
This means that any usage of `@rules_mylang` on your system will point to this folder.
43+
This means that any usage of `@rules_formatjs` on your system will point to this folder.
4444

4545
## Releasing
4646

@@ -51,7 +51,7 @@ If you do nothing, eventually the newest commits will be released automatically
5151
This automation is defined in .github/workflows/tag.yaml.
5252

5353
Rather than wait for the cron event, you can trigger manually. Navigate to
54-
https://github.com/myorg/rules_mylang/actions/workflows/tag.yaml
54+
https://github.com/formatjs/rules_formatjs/actions/workflows/tag.yaml
5555
and press the "Run workflow" button.
5656

5757
If you need control over the next release version, for example when making a release candidate for a new major,

MODULE.bazel

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,3 @@ bazel_dep(name = "bazel_lib", version = "3.0.0", dev_dependency = True)
4343
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1", dev_dependency = True)
4444

4545
bazel_dep(name = "bazelrc-preset.bzl", version = "1.6.0")
46-
47-
# FormatJS CLI toolchain
48-
formatjs_cli = use_extension("//formatjs_cli:extensions.bzl", "formatjs_cli")
49-
formatjs_cli.toolchain(version = "0.1.0")
50-
use_repo(formatjs_cli, "formatjs_cli_toolchains")
51-
52-
register_toolchains("@formatjs_cli_toolchains//:all")

MODULE.bazel.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)