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

Test on Windows in CI #317

Open
edmorley opened this issue Feb 13, 2022 · 2 comments
Open

Test on Windows in CI #317

edmorley opened this issue Feb 13, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@edmorley
Copy link
Member

As found in #313, libcnb is not currently compilable on Windows.

In order to (a) find out what needs fixing, (b) ensure it doesn't regress when we do fix it, we should experiment with running adding Windows to the CI test matrix.

Supporting Windows can also mean a few different things:

  1. No compile errors for this repo (ie: cargo check succeeds).
  2. The unit tests for this repo pass (ie: cargo test succeeds iff not using --ignored).
  3. Cross-compiling a libcnb buildpack to x86_64-unknown-linux-musl is possible on Windows (and is supported by the cross-compile assistance help).
  4. Integration tests for linux libcnb buildpacks can be run on Windows (ie: in addition to (3), libcnb-test's Docker parts work etc)
  5. libcnb can be used to create Windows buildpacks (upstream docs)

It seems (4) is not currently possible on GitHub actions (presuming nothing has changed since with the new Windows server 2022 images):
actions/runner-images#1143 (comment)

And if we ever wanted to do (5), I think that should be tracked separately (any support is currently experimental upstream, so likely not worth worrying about for now).

As such, I see this GitHub issue as potentially covering 1-3.

@edmorley edmorley added the enhancement New feature or request label Feb 13, 2022
@edmorley
Copy link
Member Author

edmorley commented Feb 13, 2022

  1. Cross-compiling a libcnb buildpack to x86_64-unknown-linux-musl is possible on Windows (and is supported by the cross-compile assistance help).

Hmm so it seems cross-compiling to x86_64-unknown-linux-musl on Windows might be a pain if any dependencies rely on C. One such dependency is ring, which is a dependency of rustls and so pretty unavoidable.

Documentation is also pretty much non-existent. I found these:
japaric/rust-cross#33 (comment)
briansmith/ring#1244
briansmith/ring#894

It does seem that for Windows users, using WSL2 might be a better option. In which case us testing natively on Windows in CI is somewhat pointless, unless:

  1. We end up having contributors that want to run check/clippy/unit tests (only) on Windows and don't want to use WSL2.
  2. We in the future end up supporting Windows buildpacks.
  3. We want to actively test on Windows to help prevent regressions with the slightly unusual libcnb usage outside of Pack use-cases (eg the use-case seen in Make libcnb_runtime_build and libcnb_runtime_detect public #313)

@messense
Copy link

messense commented Mar 9, 2022

Hmm so it seems cross-compiling to x86_64-unknown-linux-musl on Windows might be a pain if any dependencies rely on C. One such dependency is ring, which is a dependency of rustls and so pretty unavoidable.

You can give cargo-zigbuild a try, it should work on Windows. And it's also a library so you can integrate it into libcnb.rs pretty easily, for example cargo-lambda/cargo-lambda#1 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants