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

ci: run rust-tests on windows #92

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ jobs:
strategy:
fail-fast: false
matrix:
# TODO: add windows which does not support container
os: [ ubuntu-22.04 ]
os:
- ubuntu-22.04
- windows-2022
runs-on: ${{ matrix.os }}
container:
image: xd009642/tarpaulin:0.30.0
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v4
- uses: cargo-bins/cargo-binstall@main
- name: Install tarpaulin
run: cargo binstall -y cargo-tarpaulin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crrow using cargo-bins/cargo-binstall works! The job fails due to some test failure - can you look into and fix any code if needed? meanwhile i'll get binstall whitelist so it can be triggered here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xushiyan I'd love to, but I'd prefer to address the Windows code in a separate pull request.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's your thought on separator and test case? Some test failed because of rust's automatic normalize, and URL parse failed since some test cases are Linux path, and it cannot be parsed on Windows.

By the way, I think some test cases can be rewritten with https://crates.io/crates/test-case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crrow absolutely! we should separate test code fix from CI setup change. Feel free to create another PR for the test fix wrt url parsing. You may also make the code change here so we know the test fix can pass with the CI, then separate it out. It's up to you.

I've thought about using some test helper lib but not sure if https://github.com/frondeus/test-case is the best candidate. there are many crates maintained by community like https://github.com/la10736/rstest seems more popular with more recent releases. I'll create an issue about this for future refactoring work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xushiyan Do we have to handle this case? , its tricky for windows

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xushiyan Do we have to handle this case? , its tricky for windows

@crrow that path is a unix path which should not be applicable to windows os. Can we split that case to test case which does not run on windows, and also add a windows specific test case with an example windows path ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'd love to

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...I found that its still tricky, like "C:\foo", url::parse will success, it thoughts 'c' is the schema, rather than a filepath; for "\foo", url::parse and url::from_filepath will all fail; We can handle both cases by adding additional check like if current os is windows and the given str has ":\".

Can we be stricter about what qualifies as a 'valid URL'? Like a valid URL must have a schema.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crrow would you do a bit of research on how windows paths are usually handled in consideration of scheme? we want to be flexible in supporting paths - it can start with C:\, file:///, /, s3:// as these are valid paths anyway.

- name: Rust unit tests with coverage report
# https://github.com/xd009642/tarpaulin/issues/1092#issuecomment-1407739176
run: cargo tarpaulin --engine llvm --no-dead-code --no-fail-fast --all-features --workspace -o xml --output-dir ./cov-reports
Expand Down
Loading