Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

releaser: fix windows #170

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
10 changes: 4 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ jobs:
if: runner.os == 'macOS'

# Linux, macOS and Windows
- run: tools/bazel test //...
- run: ci/list_toolchains_platforms
- run: tools/bazel test //...
- run: ci/prepare_git && ci/test_example rules_cc override_repository
- run: ci/prepare_git && ci/test_example bzlmod override_module
- run: ci/zig-utils

# Test the Zig toolchain for Darwin on Darwin.
Expand All @@ -68,10 +70,6 @@ jobs:
# protoc does not compile due to `-lpthread`.
- run: ci/lint
if: runner.os != 'Windows'
# releaser fails to write `README.md` for some reason.
# Releaser emits different hashes
- run: ci/release
if: runner.os != 'Windows'
- run: ci/prepare_git && ci/test_example rules_cc override_repository
if: runner.os != 'Windows'
- run: ci/prepare_git && ci/test_example bzlmod override_module
if: runner.os != 'Windows'
2 changes: 1 addition & 1 deletion ci/test_example
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ echo --- "testing examples/$example with hermetic_cc_toolchain pointing to git r
echo --- "testing examples/$example with hermetic_cc_toolchain pointing to a directory produced by release tarball"
# generate release tarball and put to temp
REL=$(mktemp -d); trap 'rm -fr $REL' EXIT; "$root/ci/release_v99"
tar -vx -C "$REL" -f "$root/hermetic_cc_toolchain-v99.0.0.tar.gz"
tar -vxf "../../hermetic_cc_toolchain-v99.0.0.tar.gz" -C "$REL"

# lockfile_mode=off, so examples/$example/MODULE.bazel.lock does not get the override below
"$root/tools/bazel" test --lockfile_mode=off "--$override_option_name=hermetic_cc_toolchain=$REL" --test_output=errors ...
Expand Down
13 changes: 6 additions & 7 deletions tools/releaser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var (

_boilerplateFiles = []string{
"README.md",
"examples/rules_cc/WORKSPACE",
path.Join("examples", "rules_cc", "WORKSPACE"),
}
)

Expand Down Expand Up @@ -126,7 +126,6 @@ This utility is intended to handle many of the steps to release a new version.
out,
)
}
log("yes")

if err := checkZigMirrored(repoRoot); err != nil {
return fmt.Errorf("zig is correctly mirrored: %w", err)
Expand Down Expand Up @@ -447,9 +446,11 @@ func makeTgz(w io.Writer, repoRoot string, ref string) (string, error) {
return "", fmt.Errorf("close gzip stream: %w", err)
}

if err := cmd.Wait(); err != nil {
return "", fmt.Errorf("wait: %w", err)
}
// If at this point cmd.Wait() is called, it gets stuck
// on Windows. Since there isn't any value from the subprocess
// at this point, do the best-effort Kill followed by Wait.
_ = cmd.Process.Kill()
_ = cmd.Wait()

return fmt.Sprintf("%x", hashw.Sum(nil)), nil
}
Expand Down Expand Up @@ -485,8 +486,6 @@ func checkZigMirrored(repoRoot string) error {
return fmt.Errorf("got non-200: %s", resp.Status)
}

log("yes")

return nil
}

Expand Down