diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c7f371fd9f..3fde4db2a0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,35 +19,41 @@ jobs: # - name: Ninja Install # run: pip install ninja - uses: actions/checkout@v3 + - name: Setup environment + run: | + New-Item '.cargo' -ItemType 'directory' + 'build.rustflags = [''--cfg'', ''CI'']' | Out-File .cargo/config.toml -Encoding 'utf8' - name: Build tests run: cargo build --tests --verbose - name: Run tests run: cargo test --verbose - name: Build examples - run: | - cd examples - cargo build --bins --verbose + run: cargo build --bins --verbose linux_stable: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: Setup 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 --bins --verbose + run: cargo build --bins --verbose macos_stable: runs-on: macos-latest steps: - uses: actions/checkout@v3 + - name: Setup 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 --bins --verbose + run: cargo build --bins --verbose diff --git a/vulkano/src/swapchain/surface.rs b/vulkano/src/swapchain/surface.rs index fc14c6f41e..47e540129d 100644 --- a/vulkano/src/swapchain/surface.rs +++ b/vulkano/src/swapchain/surface.rs @@ -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 { + #[cfg(CI)] + return Ok(InstanceExtensions { + khr_surface: true, + ext_headless_surface: true, + ..InstanceExtensions::empty() + }); + let mut extensions = InstanceExtensions { khr_surface: true, ..InstanceExtensions::empty() @@ -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, window: &(impl HasWindowHandle + HasDisplayHandle), ) -> Result, FromWindowError> { + #[cfg(CI)] + return Self::headless(instance, None).map_err(FromWindowError::CreateSurface); + let window_handle = window .window_handle() .map_err(FromWindowError::RetrieveHandle)?;