-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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>
- Loading branch information
1 parent
0d063f1
commit 1d54cc0
Showing
3 changed files
with
94 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters