Skip to content

Commit

Permalink
Workflow improvements 3 (#3000)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Apr 17, 2024
1 parent a666eec commit 85a77ef
Show file tree
Hide file tree
Showing 7 changed files with 401 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .github/actions/fix-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ runs:
((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64")
| Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH
}
"aarch64*"
{
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH
((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64")
| Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH
}
"*"
{
(Join-Path $env:GITHUB_WORKSPACE "target\debug\deps").ToString() >> $env:GITHUB_PATH
Expand Down
308 changes: 308 additions & 0 deletions .github/workflows/arm64.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/tests/arch/tests/sys.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use windows_sys::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS;

#[test]
#[cfg(target_arch = "x86_64")]
fn test() {
use windows_sys::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS;
assert_eq!(256, core::mem::size_of::<KNONVOLATILE_CONTEXT_POINTERS>());
}

#[test]
#[cfg(target_arch = "x86")]
fn test() {
use windows_sys::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS;
assert_eq!(4, core::mem::size_of::<KNONVOLATILE_CONTEXT_POINTERS>());
}
4 changes: 2 additions & 2 deletions crates/tests/arch/tests/win.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use windows::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS;

#[test]
#[cfg(target_arch = "x86_64")]
fn test() {
use windows::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS;
assert_eq!(256, core::mem::size_of::<KNONVOLATILE_CONTEXT_POINTERS>());
}

#[test]
#[cfg(target_arch = "x86")]
fn test() {
use windows::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS;
assert_eq!(4, core::mem::size_of::<KNONVOLATILE_CONTEXT_POINTERS>());
}
15 changes: 10 additions & 5 deletions crates/tests/arch_feature/tests/sys.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use windows_sys::{
Win32::System::Diagnostics::Debug::CONTEXT,
Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD,
};

#[test]
#[cfg(target_arch = "x86_64")]
fn test() {
use windows_sys::{
Win32::System::Diagnostics::Debug::CONTEXT,
Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD,
};

assert_eq!(1232, core::mem::size_of::<CONTEXT>());

use windows_sys::Win32::System::Environment::VBS_BASIC_ENCLAVE_THREAD_DESCRIPTOR64;
Expand All @@ -21,6 +21,11 @@ fn test() {
#[test]
#[cfg(target_arch = "x86")]
fn test() {
use windows_sys::{
Win32::System::Diagnostics::Debug::CONTEXT,
Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD,
};

assert_eq!(716, core::mem::size_of::<CONTEXT>());

use windows_sys::Win32::System::Environment::VBS_BASIC_ENCLAVE_THREAD_DESCRIPTOR32;
Expand Down
15 changes: 10 additions & 5 deletions crates/tests/arch_feature/tests/win.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use windows::{
Win32::System::Diagnostics::Debug::CONTEXT,
Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD,
};

#[test]
#[cfg(target_arch = "x86_64")]
fn test() {
use windows::{
Win32::System::Diagnostics::Debug::CONTEXT,
Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD,
};

assert_eq!(1232, core::mem::size_of::<CONTEXT>());

use windows::Win32::System::Environment::VBS_BASIC_ENCLAVE_THREAD_DESCRIPTOR64;
Expand All @@ -21,6 +21,11 @@ fn test() {
#[test]
#[cfg(target_arch = "x86")]
fn test() {
use windows::{
Win32::System::Diagnostics::Debug::CONTEXT,
Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD,
};

assert_eq!(716, core::mem::size_of::<CONTEXT>());

use windows::Win32::System::Environment::VBS_BASIC_ENCLAVE_THREAD_DESCRIPTOR32;
Expand Down
63 changes: 63 additions & 0 deletions crates/tools/yml/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::fmt::Write;
fn main() {
test_yml();
clippy_yml();
arm64_yml();
}

fn test_yml() {
Expand Down Expand Up @@ -137,3 +138,65 @@ jobs:

std::fs::write(".github/workflows/clippy.yml", yml.as_bytes()).unwrap();
}

// Ideally this would just be another matrix dimension in test_yml but Cargo limitations are blocking this for the time being.
// See https://github.com/rust-lang/cargo/issues/9661
fn arm64_yml() {
let mut yml = r"name: arm64
on:
pull_request:
push:
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
branches:
- master
env:
RUSTFLAGS: -Dwarnings
jobs:
check:
runs-on: windows-2019
strategy:
matrix:
include:
- version: stable
target: aarch64-pc-windows-msvc
- version: nightly
target: aarch64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update toolchain
run: rustup update --no-self-update ${{ matrix.version }} && rustup default ${{ matrix.version }}-x86_64-pc-windows-msvc
- name: Add toolchain target
run: rustup target add ${{ matrix.target }}
- name: Fix environment
uses: ./.github/actions/fix-environment"
.to_string();

for (count, (name, _)) in lib::crates("crates").iter().enumerate() {
if count % 50 == 0 {
write!(
&mut yml,
r"
- name: Clean
run: cargo clean"
)
.unwrap();
}

write!(
&mut yml,
r"
- name: Test {name}
run: cargo test -p {name} --no-run --target ${{{{ matrix.target }}}}"
)
.unwrap();
}

std::fs::write(".github/workflows/arm64.yml", yml.as_bytes()).unwrap();
}

0 comments on commit 85a77ef

Please sign in to comment.