Run tests twice, one for main crate and once for subcrate

It seems like restoring the cache for subcrate deletes sometimes removes the compiled binaries for
the parent crate. I'm not sure what's going on here, as it doesn't happen every time.
This commit is contained in:
Dave Rolsky 2025-01-11 12:49:28 -06:00
parent a8c1049914
commit 8a64ff717c
No known key found for this signature in database
2 changed files with 53 additions and 35 deletions

View File

@ -262,27 +262,7 @@ jobs:
target: ${{ matrix.platform.target }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strip: true
- name: Run build command for subdir
uses: ./
with:
command: build
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
working-directory: subcrate
target: ${{ matrix.platform.target }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strip: true
- name: Run bench command
uses: ./
with:
command: bench
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
target: ${{ matrix.platform.target }}
working-directory: bench
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.platform.can_execute }}
- name: Check binary and cross on ${{ matrix.platform.platform_name }}
- name: Check binary and cross for main crate on ${{ matrix.platform.platform_name }}
shell: bash
run: |
set -e
@ -294,6 +274,39 @@ jobs:
--expect-cross-version "${{ matrix.platform.expect_cross_version }}" \
${{ matrix.platform.expect_cross }} \
${{ matrix.platform.expect_stripped }}
- name: Run build command for subdir
uses: ./
with:
command: build
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
working-directory: subcrate
target: ${{ matrix.platform.target }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strip: true
- name: Check binary and cross for subcrate on ${{ matrix.platform.platform_name }}
shell: bash
run: |
set -e
set -x
cargo run --manifest-path ./run-tests/Cargo.toml -- \
--checkout-root "$PWD" \
--target "${{ matrix.platform.target }}" \
--expect-file-re "${{ matrix.platform.expect_file_re }}" \
--expect-cross-version "${{ matrix.platform.expect_cross_version }}" \
${{ matrix.platform.expect_cross }} \
${{ matrix.platform.expect_stripped }} \
--is-subcrate
- name: Run bench command
uses: ./
with:
command: bench
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
target: ${{ matrix.platform.target }}
working-directory: bench
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.platform.can_execute }}
test-validate-inputs:
name: Test validate-inputs

View File

@ -24,6 +24,8 @@ struct Args {
expect_cross_version: Option<String>,
#[arg(long)]
expect_stripped: bool,
#[arg(long)]
is_subcrate: bool,
}
fn main() {
@ -39,7 +41,15 @@ fn main() {
);
let checkout_root_path = PathBuf::from(args.checkout_root);
let bin_paths = vec![
let bin_paths = if args.is_subcrate {
vec![checkout_root_path
.join("subcrate")
.join("target")
.join(&args.target)
.join("debug")
.join("subcrate")]
} else {
vec![
checkout_root_path
.join("target")
.join(&args.target)
@ -50,13 +60,8 @@ fn main() {
.join(&args.target)
.join("debug")
.join("bin2"),
checkout_root_path
.join("subcrate")
.join("target")
.join(&args.target)
.join("debug")
.join("subcrate"),
];
]
};
for mut bin_path in bin_paths {
if cfg!(windows) {