Skip to content

Commit

Permalink
chore: clippy and publish workflow (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
pevers committed Nov 20, 2022
1 parent 8733fb7 commit 8fa1f4f
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 3 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
on:
push:
# Pattern matched against refs/tags
tags:
- '*' # Push events to every tag not containing /
# Allow manual triggering
workflow_dispatch:

name: Publish

jobs:
linux:
defaults:
run:
working-directory: ./nosleep-nix
name: Publish Linux version
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install --no-install-recommends -y libdbus-1-dev dbus at-spi2-core
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
mac:
defaults:
run:
working-directory: ./nosleep-mac-sys
name: Publish macOS version
runs-on: macos-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
windows:
defaults:
run:
working-directory: ./nosleep-windows
name: Publish Windows version
runs-on: windows-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
root:
defaults:
run:
working-directory: ./nosleep
needs: [linux, macos, windows]
name: Publish root crate
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
6 changes: 3 additions & 3 deletions nosleep-windows/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ impl NoSleepHandle {
/// Stop blocking the system from entering power save mode
pub fn stop(self: &NoSleepHandle) -> Result<()> {
unsafe {
if !PowerClearRequest(&self.system_handle, PowerRequestSystemRequired).as_bool() {
if !PowerClearRequest(self.system_handle, PowerRequestSystemRequired).as_bool() {
return ClearPowerSaveModeSnafu {
option: PowerRequestSystemRequired,
}
.fail();
}
if !&self
.display_handle
.map(|h| PowerClearRequest(&h, PowerRequestDisplayRequired).as_bool())
.map(|h| PowerClearRequest(h, PowerRequestDisplayRequired).as_bool())
.unwrap_or(true)
{
return ClearPowerSaveModeSnafu {
Expand Down Expand Up @@ -107,7 +107,7 @@ fn create_power_request(power_request_type: POWER_REQUEST_TYPE) -> Result<HANDLE
};
unsafe {
let handle = PowerCreateRequest(&reason).context(CouldNotCreatePowerRequestSnafu)?;
if PowerSetRequest(&handle, power_request_type).as_bool() {
if PowerSetRequest(handle, power_request_type).as_bool() {
return Ok(handle);
}
PreventPowerSaveModeSnafu {
Expand Down

0 comments on commit 8fa1f4f

Please sign in to comment.