ci: Run all tests in isolation#89
Conversation
When using && to cd back out of a subdirectory the error code from cargo
test is implicitly consumed instead of being caught by set -e. While
this does return a non-zero exit code it does not prevent the rest of
the script from running if more lines follow.
The next lines run and, if successful, do not fail the step because GH
actions base the result of a multiline shell script solely on the last
command [1].
You can try this for yourself by throwing the following three steps in
GH actions and observing the result [2]:
false
echo "This is not printed"
false && echo "This is not printed"
false && echo "This is not printed"
echo "Oh noes, his is printed, and the script exits successfully"
In addition structuring the tests this way allows working-directory to
be used, and shows every test individually in a PR to more quickly
identify where things are going wrong.
[1]: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
[2]: https://github.com/MarijnS95/gh-actions-test/actions/runs/343934038
5c6b27b to
3d2e536
Compare
This feature does not exist anymore and breaks the tests:
error: Package `ndk v0.2.1 (/home/runner/work/android-ndk-rs/android-ndk-rs/ndk)` does not have these features: `rustdoc`
Fixes: 7d36455 ("Explicitly set docs.rs targets and bump versions to 0.2.1/0.5.3 (rust-mobile#82)")
3d2e536 to
dac3588
Compare
🎉 Looks like all tests actually run now (and succeed!) after introducing a |
|
@msiglreith I just pushed more changes to test all features :) |
|
@MarijnS95 yeah github yelled at me when I tried to merge 😃 |
b8cad18 to
40c730d
Compare
|
@msiglreith Pushed again and added |
Fixes the following failure when compiling on a host that's not android:
error: android-ndk-sys only supports compiling for Android
--> ndk-sys/src/lib.rs:18:1
|
18 | compile_error!("android-ndk-sys only supports compiling for Android");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In addition jni and jni-glue need to be linked to prevent subsequent
failures when compiling the documentation in native_activity.rs.
This crate was accidentally omitted from the tests, but contains quite a few #[test] functions that were never ran.
Certain parts of the code are omitted from testing and checking, in particular the logging feature.
While there are no tests here yet, this at least invokes the checking stage on ndk-glue.
40c730d to
76d30d3
Compare
|
@msiglreith All tests succeeded, this is ready from my perspective. Feel free to merge it after a second review, I don't think any new commits will show up :D Someone should perhaps take a look at the deprecation warning in |
When using && to cd back out of a subdirectory the error code from cargo test is implicitly consumed instead of being caught by set -e. While this does return a non-zero exit code it does not prevent the rest of the script from running if more lines follow.
The next lines run and, if successful, do not fail the step because GH actions base the result of a multiline shell script solely on the last command 1.
You can try this for yourself by throwing the following three steps in GH actions and observing the result 2:
In addition structuring the tests this way allows working-directory to be used, and shows every test individually in a PR to more quickly identify where things are going wrong.