-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: consolidate CI workflows and package with bazel
- Loading branch information
Showing
16 changed files
with
205 additions
and
113 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
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,2 +1,3 @@ | ||
bazel-* | ||
user.bazelrc | ||
/release/ |
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
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 |
---|---|---|
@@ -1,16 +1,5 @@ | ||
load(":rules.bzl", "shellcheck_test") | ||
|
||
shellcheck_test( | ||
name = "fail_test", | ||
data = [ | ||
"testdata/bad.sh", | ||
], | ||
expect_fail = True, | ||
) | ||
|
||
shellcheck_test( | ||
name = "success_test", | ||
data = [ | ||
"testdata/good.sh", | ||
], | ||
filegroup( | ||
name = "distribution", | ||
srcs = glob(["*"]), | ||
visibility = ["//:__pkg__"], | ||
) |
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,56 @@ | ||
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") | ||
load("@rules_pkg//pkg:tar.bzl", "pkg_tar") | ||
load("//:def.bzl", "shellcheck_test") | ||
|
||
pkg_files( | ||
name = "files", | ||
srcs = [ | ||
"//:distribution", | ||
], | ||
strip_prefix = strip_prefix.from_root(), | ||
) | ||
|
||
pkg_tar( | ||
name = "tar", | ||
srcs = [ | ||
":files", | ||
], | ||
out = "rules_shellcheck.tar", | ||
) | ||
|
||
genrule( | ||
name = "archive", | ||
srcs = [":tar"], | ||
outs = ["rules_shellcheck.tar.gz"], | ||
cmd = "gzip -c $< > $@", | ||
) | ||
|
||
genrule( | ||
name = "release_stamped", | ||
srcs = ["release.sh"], | ||
outs = ["release_stamped.sh"], | ||
cmd = "; ".join([ | ||
"BUILD_EMBED_LABEL=$$(grep ^BUILD_EMBED_LABEL bazel-out/stable-status.txt | cut -d' ' -f2)", | ||
"sed \"s/\\$${BUILD_EMBED_LABEL}/$$BUILD_EMBED_LABEL/g\" $< >$@", | ||
]), | ||
stamp = 1, | ||
) | ||
|
||
sh_binary( | ||
name = "release", | ||
srcs = ["release_stamped"], | ||
data = [ | ||
":archive", | ||
":release_notes.tmpl.md", | ||
], | ||
env = { | ||
"ARCHIVE": "$(location :archive)", | ||
"RELEASE_NOTES_TEMPLATE": "$(location :release_notes.tmpl.md)", | ||
}, | ||
visibility = ["//:__pkg__"], | ||
) | ||
|
||
shellcheck_test( | ||
name = "release.shellcheck", | ||
data = [":release"], | ||
) |
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,19 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
DST="${BUILD_WORKSPACE_DIRECTORY}/$1" | ||
TAG="${2:-${BUILD_EMBED_LABEL}}" | ||
|
||
mkdir -p "$DST" | ||
|
||
RELEASE_ARCHIVE="$DST/rules_shellcheck-$TAG.tar.gz" | ||
RELEASE_NOTES="$DST/release_notes.md" | ||
|
||
cp -v "$ARCHIVE" "$RELEASE_ARCHIVE" | ||
SHA=$(sha256sum "$RELEASE_ARCHIVE" | awk '{print $1}') | ||
|
||
sed \ | ||
-e "s/%%TAG%%/$1/g" \ | ||
-e "s/%%SHA256%%/$SHA/g" \ | ||
"${RELEASE_NOTES_TEMPLATE}" \ | ||
> "$RELEASE_NOTES" |
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,27 @@ | ||
## Using Bzlmod with Bazel 6 | ||
|
||
**NOTE: bzlmod support is still beta. APIs subject to change.** | ||
|
||
Add to your `MODULE.bazel` file: | ||
|
||
```starlark | ||
bazel_dep(name = "rules_shellcheck", version = "%%TAG%%") | ||
``` | ||
|
||
## Legacy: using WORKSPACE | ||
|
||
Paste this snippet into your `WORKSPACE` file: | ||
|
||
```starlark | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "rules_shellcheck", | ||
sha256 = "%%SHA256%%", | ||
url = "https://github.com/aignas/rules_shellcheck/releases/download/%%TAG%%/rules_shellcheck-%%TAG%%.tar.gz", | ||
) | ||
|
||
load("@rules_shellcheck//:deps.bzl", "shellcheck_dependencies") | ||
|
||
shellcheck_dependencies() | ||
``` |
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,16 @@ | ||
load("//internal:rules.bzl", "shellcheck_test") | ||
|
||
shellcheck_test( | ||
name = "fail_test", | ||
data = [ | ||
"testdata/bad.sh", | ||
], | ||
expect_fail = True, | ||
) | ||
|
||
shellcheck_test( | ||
name = "success_test", | ||
data = [ | ||
"testdata/good.sh", | ||
], | ||
) |
File renamed without changes.
File renamed without changes.