Skip to content

Commit

Permalink
release 0.3.0 (#147)
Browse files Browse the repository at this point in the history
* 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
smedegaard and github-actions[bot] authored Dec 23, 2024
1 parent 0d063f1 commit 1d54cc0
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 42 deletions.
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;
Expand All @@ -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::*;
Expand Down

0 comments on commit 1d54cc0

Please sign in to comment.