Skip to content

Commit

Permalink
added README.md + github ci workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lvboudre committed Nov 21, 2024
1 parent 15c8ee0 commit d3bb446
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 1 deletion.
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: Release worfklow

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# This is needed if we are using github enterprise.
permissions:
contents: write
pull-requests: write
id-token: write

on:
push:
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
release:
strategy:
matrix:
os: [ubuntu-22.04]
runs-on: [self-hosted, "${{ matrix.os }}", baremetal]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set cargo
uses: dtolnay/[email protected]

- name: Clear rust cache
run: |
cargo cache -r all
- name: Set build cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
fumarole/${{ matrix.os }}
key: ${{ matrix.os }}_fumarole_${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.os }}_fumarole
- name: Cargo fmt
if: startsWith(github.ref, 'refs/tags/') != true
run: cargo +nightly fmt --all -- --check

- name: Cargo clippy
if: startsWith(github.ref, 'refs/tags/') != true
run: cargo clippy --workspace --all-targets --tests

- name: Cargo deny check advisories
if: startsWith(github.ref, 'refs/tags/') != true
uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check advisories

- name: Cargo check the entire project
if: startsWith(github.ref, 'refs/tags/') != true
run: cargo check --all-targets --tests --all-features

- name: Set PROTOC environment variable in order to build
run: echo "PROTOC=/usr/bin/protoc" >> $GITHUB_ENV
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# rust-etcd-utils


Utility library for common ETCD management in Rust, it covers:

1. Automatic lease management.
2. Automatic lock lifecycle managemented: auto-revoke and auto-keep-alive.
3. Builtin retry logic for every public function to make robust in-production application.


## How to test

Uses `compose.yaml` to launch and instance of `etcd` with port-fowarding over the port 2379, so `localhost:2379` redirects to `etcd` instance inside docker.
5 changes: 5 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "1.79.0"
components = ["clippy", "rustfmt"]
targets = []
profile = "minimal"
3 changes: 2 additions & 1 deletion tests/test_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@ async fn test_managed_lock_scope() {

let _ = h.await;
let result = rx.await;
assert!(matches!(result, Err(_)));
// If the callback rx received a msg it means the scope didn't cancel the future as it should.
assert!(result.is_err());
}

0 comments on commit d3bb446

Please sign in to comment.