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

Testing how well we can (ab)use CI #2383

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,36 @@ jobs:
- name: Run tests
run: cargo test --verbose
- name: Build examples
run: cargo build --bins --verbose
- name: Run examples
run: |
cd examples
cargo build --verbose
./run_all_headless.ps1
linux_stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up environment
run: |
mkdir .cargo
echo 'build.rustflags = ["--cfg", "CI"]' > .cargo/config.toml
- name: Build tests
run: cargo build --tests --verbose
- name: Run tests
run: cargo test --verbose
- name: Build examples
run: |
cd examples
cargo build --verbose
run: cargo build --bins --verbose
macos_stable:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Set up environment
run: |
mkdir .cargo
echo 'build.rustflags = ["--cfg", "CI"]' > .cargo/config.toml
- name: Build tests
run: cargo build --tests --verbose
- name: Run tests
run: cargo test --verbose
- name: Build examples
run: |
cd examples
cargo build --verbose
run: cargo build --bins --verbose
3 changes: 3 additions & 0 deletions examples/run_all.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cargo build --bins
@(Get-ChildItem -Directory -Name) | %{cargo run --bin $_}
rm pipeline-caching\pipeline_cache.bin
13 changes: 13 additions & 0 deletions examples/run_all_headless.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
foreach ($example in Get-ChildItem -Directory -Name) {
$proc = Start-Process -FilePath "cargo" -ArgumentList "run --bin $example" -NoNewWindow -PassThru

$timeouted = $null

Wait-Process -InputObject $proc -Timeout 15 -ErrorAction SilentlyContinue -ErrorVariable timeouted

if ($timeouted) {
kill $proc
} elseif ($proc.ExitCode -ne 0) {
Exit $proc.ExitCode
}
}
5 changes: 5 additions & 0 deletions examples/run_all_headless.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail

exa -F . | rg '/$' | sd '/' '' | rargs timeout --preserve-status 15s cargo run --bin {}
rm -f pipeline-caching/pipeline_cache.bin
12 changes: 12 additions & 0 deletions vulkano/src/swapchain/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,17 @@ pub struct Surface {
impl Surface {
/// Returns the instance extensions required to create a surface from a window of the given
/// event loop.
#[cfg_attr(CI, allow(unreachable_code, unused))]
pub fn required_extensions(
event_loop: &impl HasDisplayHandle,
) -> Result<InstanceExtensions, HandleError> {
#[cfg(CI)]
return Ok(InstanceExtensions {
khr_surface: true,
ext_headless_surface: true,
..InstanceExtensions::empty()
});

let mut extensions = InstanceExtensions {
khr_surface: true,
..InstanceExtensions::empty()
Expand Down Expand Up @@ -100,10 +108,14 @@ impl Surface {
/// # Safety
///
/// - The given `window` must outlive the created surface.
#[cfg_attr(CI, allow(unreachable_code, unused))]
pub unsafe fn from_window_ref(
instance: Arc<Instance>,
window: &(impl HasWindowHandle + HasDisplayHandle),
) -> Result<Arc<Self>, FromWindowError> {
#[cfg(CI)]
return Self::headless(instance, None).map_err(FromWindowError::CreateSurface);

let window_handle = window
.window_handle()
.map_err(FromWindowError::RetrieveHandle)?;
Expand Down
Loading