Skip to content

Commit

Permalink
Expand raw-dylib testing (#3287)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Sep 19, 2024
1 parent 4442770 commit bf53fa6
Show file tree
Hide file tree
Showing 8 changed files with 388 additions and 56 deletions.
360 changes: 360 additions & 0 deletions .github/workflows/raw-dylib.yml

Large diffs are not rendered by default.

46 changes: 0 additions & 46 deletions .github/workflows/raw_dylib.yml

This file was deleted.

2 changes: 1 addition & 1 deletion crates/samples/components/json_validator_client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
}

println!("cargo:rerun-if-changed=src/client.cpp");
println!("cargo:rustc-link-lib=windows.0.52.0");
println!("cargo:rustc-link-lib=onecoreuap");

cc::Build::new()
.cpp(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
}

println!("cargo:rerun-if-changed=src/client.cpp");
println!("cargo:rustc-link-lib=windows.0.52.0");
println!("cargo:rustc-link-lib=onecoreuap");

let include = std::env::var("OUT_DIR").unwrap();

Expand Down
1 change: 1 addition & 0 deletions crates/tests/winrt/composable_client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ fn main() {
}

println!("cargo:rerun-if-changed=src/interop.cpp");
println!("cargo:rustc-link-lib=onecoreuap");

windows_bindgen::bindgen([
"--in",
Expand Down
1 change: 1 addition & 0 deletions crates/tests/winrt/constructors_client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ fn main() {
}

println!("cargo:rerun-if-changed=src/interop.cpp");
println!("cargo:rustc-link-lib=onecoreuap");

windows_bindgen::bindgen([
"--in",
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/winrt/noexcept/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main() {
let metadata_dir = format!("{}\\System32\\WinMetadata", env!("windir"));
let mut command = std::process::Command::new("midlrt.exe");
println!("cargo:rerun-if-changed=src/interop.cpp");
println!("cargo:rustc-link-lib=windows.0.52.0");
println!("cargo:rustc-link-lib=onecoreuap");

command.args([
"/winrt",
Expand Down
30 changes: 23 additions & 7 deletions crates/tools/yml/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use std::fmt::Write;

fn main() {
test_yml();
test_yml("test", false);
test_yml("raw-dylib", true);
clippy_yml();
no_default_features_yml();
}

fn test_yml() {
let mut yml = r"name: test
fn test_yml(name: &str, raw_dylib: bool) {
let mut yml = format!(
r"name: {name}
on:
pull_request:
Expand All @@ -17,7 +19,21 @@ on:
- 'web/**'
branches:
- master
"
);

if raw_dylib {
write!(
&mut yml,
r"
env:
RUSTFLAGS: --cfg windows_raw_dylib
"
)
.unwrap();
}

write!(&mut yml, r"
jobs:
check:
runs-on: windows-2022
Expand Down Expand Up @@ -54,14 +70,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Update toolchain
run: rustup update --no-self-update ${{ matrix.version }} && rustup default ${{ matrix.version }}-${{ matrix.host }}
run: rustup update --no-self-update ${{{{ matrix.version }}}} && rustup default ${{{{ matrix.version }}}}-${{{{ matrix.host }}}}
- name: Add toolchain target
run: rustup target add ${{ matrix.target }}
run: rustup target add ${{{{ matrix.target }}}}
- name: Install fmt
run: rustup component add rustfmt
- name: Fix environment
uses: ./.github/actions/fix-environment"
.to_string();
).unwrap();

// This unrolling is required since "cargo test --all" consumes too much memory for the GitHub hosted runners
// and the occasional "cargo clean" is required to avoid running out of disk space in the same runners.
Expand Down Expand Up @@ -98,7 +114,7 @@ jobs:
)
.unwrap();

std::fs::write(".github/workflows/test.yml", yml.as_bytes()).unwrap();
std::fs::write(format!(".github/workflows/{name}.yml"), yml.as_bytes()).unwrap();
}

fn clippy_yml() {
Expand Down

0 comments on commit bf53fa6

Please sign in to comment.