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

Release #159

Merged
merged 3 commits into from
Dec 31, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
release 0.3.0 (#147)
* chore: release v0.1.2 (#129)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* add hip_call() (#143)

* add docs step to release job (#145)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* add docs step to release job (#146)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
smedegaard and github-actions[bot] authored Dec 23, 2024
commit 1d54cc0860e4c2a5e71e3624cc1d5078a5236e46
99 changes: 57 additions & 42 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,65 @@
name: Release

permissions:
pull-requests: write
contents: write
pull-requests: write
contents: write

on:
push:
branches:
- release
push:
branches:
- release

jobs:
# Release unpublished packages.
release-plz-release:
name: Release-plz release
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run release-plz
uses: release-plz/[email protected]
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
# Release unpublished packages.
release-plz-release:
name: Release-plz release
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run release-plz
uses: release-plz/[email protected]
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}

# Create a PR with the new versions and changelog, preparing the next release.
release-plz-pr:
name: Release-plz PR
runs-on: self-hosted
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/[email protected]
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
# Create a PR with the new versions and changelog, preparing the next release.
release-plz-pr:
name: Release-plz PR
runs-on: self-hosted
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/[email protected]
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}

docs:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Generate Docs
run: cargo doc --no-deps --document-private-items
- name: Add index.html
run: |
echo '<meta http-equiv="refresh" content="0; url=your_crate_name/index.html">' > target/doc/index.html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
35 changes: 35 additions & 0 deletions src/core/hip_call.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use super::{sys, HipResult, Result};

#[macro_export]
macro_rules! hip_call {
($call:expr) => {{
let code = unsafe { $call };
((), code).to_result()
}};
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_hip_call_simple() {
let result = hip_call!(sys::hipDeviceSynchronize());
assert!(result.is_ok());
}

#[test]
fn test_hip_call_with_value() {
let mut count = 0;
let result = hip_call!(sys::hipGetDeviceCount(&mut count));
assert!(result.is_ok());
assert!(count > 0);
}

#[test]
fn test_hip_call_error() {
// Call with invalid device ID should return error
let result = hip_call!(sys::hipSetDevice(99));
assert!(result.is_err());
}
}
2 changes: 2 additions & 0 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod device;
mod device_types;
mod flags;
mod hip_call;
mod init;
mod memory;
mod result;
@@ -11,6 +12,7 @@ pub mod sys;
pub use device::*;
pub use device_types::*;
pub use flags::*;
pub use hip_call::*;
pub use init::*;
pub use memory::*;
pub use result::*;