-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
273 additions
and
206 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
releaseKind: | ||
description: "Kind of release" | ||
default: "minor" | ||
type: choice | ||
options: | ||
- patch | ||
- minor | ||
required: true | ||
|
||
jobs: | ||
rust: | ||
name: release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.DENOBOT_PAT }} | ||
|
||
- uses: denoland/setup-deno@v1 | ||
- uses: dsherret/rust-toolchain-file@v1 | ||
|
||
- name: Tag and release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.DENOBOT_PAT }} | ||
GH_WORKFLOW_ACTOR: ${{ github.actor }} | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "denobot" | ||
deno run -A https://raw.githubusercontent.com/denoland/automation/0.15.0/tasks/publish_release.ts --${{github.event.inputs.releaseKind}} |
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
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
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
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
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
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
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,52 @@ | ||
// Copyright 2018-2024 the Deno authors. MIT license. | ||
|
||
use std::sync::atomic::AtomicBool; | ||
use std::sync::atomic::Ordering; | ||
|
||
/// Simplifies the use of an atomic boolean as a flag. | ||
#[derive(Debug, Default)] | ||
pub struct AtomicFlag(AtomicBool); | ||
|
||
impl AtomicFlag { | ||
/// Creates a new flag that's raised. | ||
pub fn raised() -> AtomicFlag { | ||
Self(AtomicBool::new(true)) | ||
} | ||
|
||
/// Raises the flag returning if the raise was successful. | ||
pub fn raise(&self) -> bool { | ||
!self.0.swap(true, Ordering::SeqCst) | ||
} | ||
|
||
/// Lowers the flag returning if the lower was successful. | ||
pub fn lower(&self) -> bool { | ||
self.0.swap(false, Ordering::SeqCst) | ||
} | ||
|
||
/// Gets if the flag is raised. | ||
pub fn is_raised(&self) -> bool { | ||
self.0.load(Ordering::SeqCst) | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use super::*; | ||
|
||
#[test] | ||
fn atomic_flag_raises_lowers() { | ||
let flag = AtomicFlag::default(); | ||
assert!(!flag.is_raised()); // false by default | ||
assert!(flag.raise()); | ||
assert!(flag.is_raised()); | ||
assert!(!flag.raise()); | ||
assert!(flag.is_raised()); | ||
assert!(flag.lower()); | ||
assert!(flag.raise()); | ||
assert!(flag.lower()); | ||
assert!(!flag.lower()); | ||
let flag = AtomicFlag::raised(); | ||
assert!(flag.is_raised()); | ||
assert!(flag.lower()); | ||
} | ||
} |
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,5 @@ | ||
// Copyright 2018-2024 the Deno authors. MIT license. | ||
|
||
mod flag; | ||
|
||
pub use flag::AtomicFlag; |
Oops, something went wrong.