diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 8e8bb10..236d86d 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -22,11 +22,11 @@ permissions: contents: read jobs: - build: + build-and-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Check if oneAPI is already installed id: check-oneapi @@ -57,9 +57,16 @@ jobs: - name: Build run: cargo build --verbose - - - name: Run tests - run: cargo test --verbose + + - name: Run workspace tests + run: cargo test --workspace --verbose + + - name: Run examples + run: | + for example_path in oneapi-rs/examples/*.rs; do + example="$(basename "$example_path" .rs)" + cargo run -p oneapi-rs --example "$example" --verbose + done - name: Generate documentation run: | @@ -79,14 +86,14 @@ jobs: HTML - name: Upload documentation artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: documentation path: target/doc deploy-documentation: if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.deploy_documentation == 'true') - needs: build + needs: build-and-test runs-on: ubuntu-latest permissions: @@ -100,19 +107,19 @@ jobs: steps: - name: Download documentation artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v7 with: name: documentation path: target/doc - name: Configure GitHub Pages - uses: actions/configure-pages@v5 + uses: actions/configure-pages@v6 - name: Upload documentation to GitHub Pages - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v5 with: path: target/doc - name: Deploy documentation to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v5 diff --git a/oneapi-rs/tests/alloc.rs b/oneapi-rs/tests/alloc.rs new file mode 100644 index 0000000..b931ee9 --- /dev/null +++ b/oneapi-rs/tests/alloc.rs @@ -0,0 +1,21 @@ +// +// Copyright (C) 2026 Intel Corporation +// +// Under the MIT License or the Apache License v2.0. +// See LICENSE-MIT and LICENSE-APACHE for license information. +// SPDX-License-Identifier: MIT OR Apache-2.0 +// + +use oneapi_rs::queue::Queue; + +#[test] +fn shared_allocation_host_values() { + let queue = Queue::new(); + let mut buffer = unsafe { queue.alloc_uninit_shared::(10) }; + + for (index, value) in buffer.iter_mut().enumerate() { + *value = index as u32; + } + + assert_eq!(buffer.as_ref(), &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); +}