diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml new file mode 100644 index 0000000..338b703 --- /dev/null +++ b/.github/workflows/basic.yml @@ -0,0 +1,106 @@ +name: Basic + +on: + push: + branches: [ "main" ] + + pull_request: + branches: [ "main" ] + + workflow_dispatch: + inputs: + generate_documentation: + description: Generate documentation + required: false + type: boolean + default: false + +env: + CARGO_TERM_COLOR: always + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Check if oneAPI is already installed + id: check-oneapi + run: | + if [ -f /opt/intel/oneapi/setvars.sh ]; then + echo "installed=true" >> $GITHUB_OUTPUT + else + echo "installed=false" >> $GITHUB_OUTPUT + fi + + - name: Setup oneAPI + if: steps.check-oneapi.outputs.installed != 'true' + run: | + # download and install oneAPI + wget --no-verbose https://registrationcenter-download.intel.com/akdlm/IRC_NAS/33cb2a22-ddf1-4aa9-8d68-1f5a118acaf2/intel-oneapi-toolkit-2026.1.0.192_offline.sh + sudo sh ./intel-oneapi-toolkit-2026.1.0.192_offline.sh -a --silent --cli --eula accept + + - name: Configure oneAPI environment + run: | + source /opt/intel/oneapi/setvars.sh + # copy envs to github + printenv | grep -E '^(PATH|LD_LIBRARY_PATH|LIBRARY_PATH|CPATH|C_INCLUDE_PATH|CPLUS_INCLUDE_PATH)=' >> $GITHUB_ENV + icx --version + sycl-ls --verbose + + - name: Build + run: cargo build --verbose + + - name: Run tests + run: cargo test --verbose + + - name: Generate documentation (on demand) + if: github.event_name == 'workflow_dispatch' && inputs.generate_documentation + run: cargo doc --workspace --no-deps --verbose + + - name: Add documentation landing page + if: github.event_name == 'workflow_dispatch' && inputs.generate_documentation + run: | + cat > target/doc/index.html <<'HTML' + + + + + + oneapi-rs documentation + + +

oneapi-rs documentation

+ + + HTML + + - name: Configure GitHub Pages + if: github.event_name == 'workflow_dispatch' && inputs.generate_documentation + uses: actions/configure-pages@v5 + + - name: Upload documentation to GitHub Pages + if: github.event_name == 'workflow_dispatch' && inputs.generate_documentation + uses: actions/upload-pages-artifact@v3 + with: + path: target/doc + + deploy-documentation: + if: github.event_name == 'workflow_dispatch' && inputs.generate_documentation + needs: build + runs-on: ubuntu-latest + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy documentation to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/oneapi-rs-sys/build.rs b/oneapi-rs-sys/build.rs index 63ef79e..a495919 100644 --- a/oneapi-rs-sys/build.rs +++ b/oneapi-rs-sys/build.rs @@ -44,7 +44,7 @@ fn main() { .compile("oneapi-shim"); println!("cargo::rustc-link-lib=sycl"); - println!("cargo::rustc-link-lib=ze_loader"); + // println!("cargo::rustc-link-lib=ze_loader"); println!("cargo::rustc-link-lib=intlc"); for source in cpp_sources { @@ -66,7 +66,7 @@ fn get_compiler_path() -> Result { if let Ok(path) = std::env::var("CMPLR_ROOT") { let path = PathBuf::from(path).join("bin/icpx"); if path.exists() { - return Ok(path) + return Ok(path); } } if let Ok(path) = which("icpx") { @@ -79,5 +79,8 @@ fn get_compiler_path() -> Result { return Ok(path); } - Err(Error::new(std::io::ErrorKind::NotFound, "No DPC++ compiler found")) + Err(Error::new( + std::io::ErrorKind::NotFound, + "No DPC++ compiler found", + )) }