From 6c2f61012235a7cf3c3e77a255eb57114787f0c7 Mon Sep 17 00:00:00 2001 From: Elvis Wianda Date: Sun, 24 Mar 2024 17:24:10 -0400 Subject: [PATCH 1/2] Configure bcr --- .bcr/config.yml | 3 ++ .bcr/metadata.template.json | 18 +++++++++ .bcr/presubmit.yml | 12 ++++++ .bcr/source.template.json | 5 +++ .github/workflows/release.yml | 5 ++- .github/workflows/workspace_snippet.sh | 20 ++++------ examples/nextjs/.bazelrc | 1 + examples/nextjs/MODULE.bazel | 53 ++++++++++++++++++++++++++ examples/nextjs/WORKSPACE | 2 +- 9 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 .bcr/config.yml create mode 100644 .bcr/metadata.template.json create mode 100644 .bcr/presubmit.yml create mode 100644 .bcr/source.template.json create mode 100644 examples/nextjs/.bazelrc create mode 100644 examples/nextjs/MODULE.bazel diff --git a/.bcr/config.yml b/.bcr/config.yml new file mode 100644 index 0000000..0d27c7c --- /dev/null +++ b/.bcr/config.yml @@ -0,0 +1,3 @@ +fixedReleaser: + login: ewianda + email: elvis@benchsci.com diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json new file mode 100644 index 0000000..39ff780 --- /dev/null +++ b/.bcr/metadata.template.json @@ -0,0 +1,18 @@ +{ + "homepage": "https://github.com/benchsci/rules_nodejs_gazelle", + "maintainers": [ + { + "name": "Elvis Wianda", + "email": "elvis@benchsci.com", + "github": "ewianda" + }, + { + "name": "Collin Heathman", + "email": "cheathman@benchsci.com", + "github": "ColinHeathman" + } + ], + "repository": ["https://github.com/benchsci/rules_nodejs_gazelle"], + "versions": [], + "yanked_versions": {} +} diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml new file mode 100644 index 0000000..cecf772 --- /dev/null +++ b/.bcr/presubmit.yml @@ -0,0 +1,12 @@ +bcr_test_module: + module_path: 'examples/nextjs' + matrix: + bazel: ['7.x', '6.x'] + platform: ['debian10', 'macos', 'ubuntu2004', 'windows'] + tasks: + run_tests: + name: 'Run test module' + bazel: ${{ bazel }} + platform: ${{ platform }} + test_targets: + - '//apps/alpha/...' diff --git a/.bcr/source.template.json b/.bcr/source.template.json new file mode 100644 index 0000000..9b852e3 --- /dev/null +++ b/.bcr/source.template.json @@ -0,0 +1,5 @@ +{ + "integrity": "**leave this alone**", + "strip_prefix": "{REPO}-{VERSION}", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_nodejs_gazelle-{TAG}.tar.gz" +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e58b41..e0803fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: # Bazel will download bazel to here XDG_CACHE_HOME: ~/.cache/bazel-repo run: bazel test //... - - name: Prepare workspace snippet + - name: Prepare Release run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt - name: Release uses: benchsci/action-gh-release@v1 @@ -35,3 +35,6 @@ jobs: # Use GH feature to populate the changelog automatically generate_release_notes: true body_path: release_notes.txt + files: rules_nodejs_gazelle-*.tar.gz + fail_on_unmatched_files: true + diff --git a/.github/workflows/workspace_snippet.sh b/.github/workflows/workspace_snippet.sh index b768e25..9b263b7 100755 --- a/.github/workflows/workspace_snippet.sh +++ b/.github/workflows/workspace_snippet.sh @@ -5,23 +5,19 @@ set -o errexit -o nounset -o pipefail # Set by GH actions, see # https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables NAME=rules_nodejs_gazelle -COMMIT=$(git rev-parse HEAD) -PREFIX=${NAME}-${COMMIT} -SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${COMMIT} | gzip | shasum -a 256 | awk '{print $1}') -INTEGRITY=$(git archive --format=tar --prefix=${PREFIX}/ ${COMMIT} | gzip | openssl dgst -sha256 -binary | openssl base64 -A) +TAG=${GITHUB_REF_NAME} +# The prefix is chosen to match what GitHub generates for source archives +PREFIX="${NAME}-${TAG:1}" +ARCHIVE="${NAME}-$TAG.tar.gz" +git archive --format=tar --prefix="${PREFIX}/" "${TAG}" | gzip >"$ARCHIVE" +SHA=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}') cat < Date: Mon, 25 Mar 2024 15:08:24 -0400 Subject: [PATCH 2/2] Change to run_targets --- .bcr/metadata.template.json | 2 +- .bcr/presubmit.yml | 4 ++-- examples/nextjs/MODULE.bazel | 6 ++++-- examples/nextjs/WORKSPACE.bzlmod | 0 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 examples/nextjs/WORKSPACE.bzlmod diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json index 39ff780..15fea91 100644 --- a/.bcr/metadata.template.json +++ b/.bcr/metadata.template.json @@ -7,7 +7,7 @@ "github": "ewianda" }, { - "name": "Collin Heathman", + "name": "Colin Heathman", "email": "cheathman@benchsci.com", "github": "ColinHeathman" } diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index cecf772..5941b69 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -8,5 +8,5 @@ bcr_test_module: name: 'Run test module' bazel: ${{ bazel }} platform: ${{ platform }} - test_targets: - - '//apps/alpha/...' + run_targets: + - '//:gazelle' diff --git a/examples/nextjs/MODULE.bazel b/examples/nextjs/MODULE.bazel index fb2299b..39e897f 100644 --- a/examples/nextjs/MODULE.bazel +++ b/examples/nextjs/MODULE.bazel @@ -4,11 +4,13 @@ module( compatibility_level = 1, ) -bazel_dep(name = "aspect_rules_js", version = "1.26.0") +bazel_dep(name = "aspect_rules_js", version = "1.27.0") +bazel_dep(name = "gazelle", version = "0.34.0", repo_name = "bazel_gazelle") +bazel_dep(name = "rules_go", version = "0.42.0", repo_name = "io_bazel_rules_go") bazel_dep(name = "bazel_skylib", version = "1.4.1") bazel_dep(name = "aspect_rules_ts", version = "1.4.0") bazel_dep(name = "aspect_rules_jest", version = "0.0.0", repo_name = "aspect_rules_jest") - +bazel_dep(name = "com_github_benchsci_rules_nodejs_gazelle", version = "0.0.0", repo_name = "com_github_benchsci_rules_nodejs_gazelle") local_path_override( module_name = "com_github_benchsci_rules_nodejs_gazelle", path = "../..", diff --git a/examples/nextjs/WORKSPACE.bzlmod b/examples/nextjs/WORKSPACE.bzlmod new file mode 100644 index 0000000..e69de29