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

.github: CICD: add workspace test to build matrix #7386

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

drinkcat
Copy link
Contributor

@drinkcat drinkcat commented Mar 3, 2025

Add a new Linux build that runs without cross, and adds
--workspace to the cargo test command.

From cargo test documentation, this option "tests all members in
the workspace.". For example, this includes running tests within
the uucore package (see #7383).

Fixes #7392.

Copy link

github-actions bot commented Mar 3, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@drinkcat
Copy link
Contributor Author

drinkcat commented Mar 3, 2025

Lots of failures, at build time for now...

some ubuntu are missing selinux headers (should be easy to fix):

  selinux-sys: Failed to find 'selinux/selinux.h'. Please make sure the C header files of libselinux are installed and accessible: Kind(NotFound)

Build (ubuntu-latest, i686-unknown-linux-musl, feat_os_unix_musl, use-cross):

error[E0432]: unresolved import `crate::utmpx`
  --> src/uucore/src/lib/features/uptime.rs:93:16
   |
93 |     use crate::utmpx::Utmpx;
   |                ^^^^^ could not find `utmpx` in the crate root
   |
note: found an item that was configured out
  --> src/uucore/src/lib/lib.rs:98:26
   |
98 | pub use crate::features::utmpx;
   |                          ^^^^^

macos, unclear what's the problem exactly:

error: couldn't read /Users/runner/work/coreutils/coreutils/target/aarch64-apple-darwin/debug/build/fts-sys-bdca82aeb17ec986/out/fts-sys.rs: No such file or directory (os error 2)
  --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fts-sys-0.2.14/src/lib.rs:24:1
   |
24 | include!(concat!(env!("OUT_DIR"), "/fts-sys.rs"));
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `fts-sys` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

Windows:

error: failed to run custom build command for `uu_stdbuf_libstdbuf v0.0.29 (D:\a\coreutils\coreutils\src\uu\stdbuf\src\libstdbuf)`
...
  src/libstdbuf.rs(18): error C2065: 'constructor': undeclared identifier
  src/libstdbuf.rs(18): error C2182: '__attribute': this use of 'void' is not valid
  src/libstdbuf.rs(19): error C2146: syntax error: missing ';' before identifier '__stdbuf_init'
  src/libstdbuf.rs(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  src/libstdbuf.rs(21): warning C4508: '__stdbuf_init': function should return a value; 'void' return type assumed

Copy link

github-actions bot commented Mar 3, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@drinkcat drinkcat force-pushed the ci branch 3 times, most recently from 273075a to 66d7595 Compare March 3, 2025 21:33
@drinkcat drinkcat changed the title .github: CICD: add --workspace to cargo test .github: CICD: add --workspace to cargo test (TEST: do not merge) Mar 3, 2025
Copy link

github-actions bot commented Mar 3, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

Copy link

github-actions bot commented Mar 3, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@drinkcat
Copy link
Contributor Author

drinkcat commented Mar 4, 2025

Thanks for the rebase @sylvestre ,-)

I think this looks good? The uucore tests are being run, at least.

Will look into this one, and clean this up:

Run actions/upload-artifact@v4
With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

Copy link

github-actions bot commented Mar 4, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@drinkcat drinkcat changed the title .github: CICD: add --workspace to cargo test (TEST: do not merge) .github: CICD: add workspace test to build matrix Mar 4, 2025
Copy link

github-actions bot commented Mar 4, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@drinkcat
Copy link
Contributor Author

drinkcat commented Mar 4, 2025

Should be good, ready for review!

@@ -624,6 +627,14 @@ jobs:
esac
outputs CARGO_CMD
outputs CARGO_CMD_OPTIONS
outputs ARTIFACTS_SUFFIX
CARGO_TEST_OPTIONS=''
case '${{ matrix.job.workspace-tests }}' in
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nice to document here why we have "workspace-tests"?
(afaik, because it doesn't work well because of cross compil, right)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Added a couple of comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks

out of scope but do you think we should move away from the cross image?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure... I'm a bit surprised cross-rs still use 16.04 by default... and... that a new release hasn't happened in 2 years milestone tracking? Development seems active though.

The convenience of cross, and the fact that it's really easy to reproduce CI builds locally, is really nice though...

It is possible to force cross to use a new image though (:main uses 20.04, which is... better already I guess?). It looks like the workspace tests can pass with something like this in Cross.toml:

[build]
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH", 
    "apt-get update && apt-get --assume-yes install libselinux1-dev:$CROSS_DEB_ARCH"
]
[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main"

(the last 2 lines would need to be copy-pasted a few times, I don't see a way to use the :main tag for all targets?! -- and :main syntax is only supported after 0.2.5)

One downside is that the main image is frequently updated, so I guess we'd be at the mercy of upstream breakage, so I think a fixed tag would be slightly safer (we could manually fix a sha if we wanted to, but we'd need to set it for each architecture though, not great in terms of maintenance...)

I think the current solution is still the simplest, and good as a stop-gap at least. But if you want to add --workspace tests for *-musl and i686, we should probably rethink (and check with cross developer on what is blocking a new release).

Add a new Linux build that runs without `cross`, and adds
`--workspace` to the cargo test command.

From cargo test documentation, this option "tests all members in
the workspace.". For example, this includes running tests within
the `uucore` package (see uutils#7383).

Fixes uutils#7392.
Copy link

github-actions bot commented Mar 4, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@sylvestre sylvestre merged commit 52a5f19 into uutils:main Mar 5, 2025
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run all workspace tests in CI (x86-64 Linux)
2 participants