Skip to content

Commit

Permalink
Put exec_platforms back on //:tars, use `--strategy=PackageTar=w…
Browse files Browse the repository at this point in the history
…orker,sandboxed,local` to avoid it executing with docker or remote.
  • Loading branch information
nickbreen committed Sep 17, 2023
1 parent 317aa00 commit 205fd3c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
- uses: actions/checkout@v3
- name: Work around https://github.com/actions/upload-artifact/issues/92
run: echo "bazel_out=$(sudo runuser -u runner -g runner -G docker -- bazel info output_path)" >> $GITHUB_ENV
- name: Bazel Build
run: sudo runuser -u runner -g runner -G docker -- bazel build hellos tars rpms debs
- name: Bazel Host Tests
run: sudo runuser -u runner -g runner -G docker -- bazel test --strategy=TestRunner=sandboxed host-{hellos,tars}-test # We won't test the RPM and DEB tests on the host as they actually install the package.
- uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -79,6 +81,8 @@ jobs:
- uses: actions/checkout@v3
- name: Work around https://github.com/actions/upload-artifact/issues/92
run: echo "bazel_out=$(bazel info output_path)" >> $GITHUB_ENV
- name: Bazel Build
run: bazel build hellos tars rpms debs
- name: Bazel Test
run: bazel test platform-{hello,tar,rpm,deb}-test-suite
- uses: actions/upload-artifact@v3
Expand Down
8 changes: 4 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ pkg_tar(
srcs = [":pkg/hello"],
)

# Expand :tar to build for all platforms on the host platform! We can do this
# because it's just tar. We do it by omitting the exec_platforms.
# We have to do it for CentOS6 as it happens as its Python 3.4 is too old for
# the pkg_tar rule and it fails.
# Expand :tar to build for all platforms.
# Theoretically we should just be able to remove the exec_platforms (or add
# just @local_config_platform//:host) but there's wrong with it right now.
platforms(
name = "tars",
actual = ":tar",
exec_platforms = _all_platforms,
target_platforms = _all_platforms,
)

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ Problems...
declare that it is executable on the host: that seems to propagate to being
instructions to compile `//:hello` for the host too.

3. We avoided having to think about the difference between target and exec platform by
specifying both with the same values. TODO figure that out. I.e. we should be able
to specify that `//:tars` _targets_ all platforms, but can _execute_ on the host.
---

References:
Expand Down

0 comments on commit 205fd3c

Please sign in to comment.