Skip to content

Commit

Permalink
Check in assets that we "//go:embed" into our executables
Browse files Browse the repository at this point in the history
This makes it easier to import Buildbarn packages from within non-Bazel
projects.
  • Loading branch information
EdSchouten committed Feb 9, 2024
1 parent d35992e commit 4b977d3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@
"name": "Protobuf generation",
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
},
{
"name": "Embedded asset generation",
"run": "bazel build $(git grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |//\\1:|' | sort -u)\ngit grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |\\1/|' | while read o; do\n if [ -e \"bazel-bin/$o\" ]; then\n rm -rf \"$o\"\n cp -r \"bazel-bin/$o\" \"$o\"\n find \"$o\" -type f -exec chmod -x {} +\n fi\ndone\n"
},
{
"name": "Test style conformance",
"run": "git diff --exit-code HEAD --"
"run": "git add . && git diff --exit-code HEAD --"
},
{
"name": "Golint",
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/pull-requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@
"name": "Protobuf generation",
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
},
{
"name": "Embedded asset generation",
"run": "bazel build $(git grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |//\\1:|' | sort -u)\ngit grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |\\1/|' | while read o; do\n if [ -e \"bazel-bin/$o\" ]; then\n rm -rf \"$o\"\n cp -r \"bazel-bin/$o\" \"$o\"\n find \"$o\" -type f -exec chmod -x {} +\n fi\ndone\n"
},
{
"name": "Test style conformance",
"run": "git diff --exit-code HEAD --"
"run": "git add . && git diff --exit-code HEAD --"
},
{
"name": "Golint",
Expand Down
6 changes: 6 additions & 0 deletions pkg/otel/stylesheet.css

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

15 changes: 14 additions & 1 deletion tools/github_workflows/workflows_template.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,22 @@
done
|||,
},
{
name: 'Embedded asset generation',
run: |||
bazel build $(git grep '^[[:space:]]*//go:embed ' | sed -e 's|\(.*\)/.*//go:embed |//\1:|' | sort -u)
git grep '^[[:space:]]*//go:embed ' | sed -e 's|\(.*\)/.*//go:embed |\1/|' | while read o; do
if [ -e "bazel-bin/$o" ]; then
rm -rf "$o"
cp -r "bazel-bin/$o" "$o"
find "$o" -type f -exec chmod -x {} +
fi
done
|||,
},
{
name: 'Test style conformance',
run: 'git diff --exit-code HEAD --',
run: 'git add . && git diff --exit-code HEAD --',
},
{
name: 'Golint',
Expand Down

0 comments on commit 4b977d3

Please sign in to comment.