Skip to content

Commit

Permalink
releaser: fix windows
Browse files Browse the repository at this point in the history
Enables example tests on Windows.
  • Loading branch information
Motiejus Jakštys committed Feb 23, 2024
1 parent d194787 commit 0d9be3c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
12 changes: 4 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ 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/release
- run: ci/zig-utils

# Test the Zig toolchain for Darwin on Darwin.
Expand All @@ -68,10 +71,3 @@ jobs:
# protoc does not compile due to `-lpthread`.
- run: ci/lint
if: runner.os != 'Windows'
# releaser fails to write `README.md` for some reason.
- 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'
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

0 comments on commit 0d9be3c

Please sign in to comment.