-
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.
- Loading branch information
Showing
19 changed files
with
1,200 additions
and
78 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,63 @@ | ||
name: Cli-client | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: cli-client | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Run tests | ||
run: cargo test | ||
|
||
fmt: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Enforce formatting | ||
run: cargo fmt -- --check | ||
|
||
clippy: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy | ||
|
||
- name: Linting | ||
run: cargo clippy -- -D warnings | ||
|
||
coverage: | ||
name: Code coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Install tarpaulin | ||
run: cargo install cargo-tarpaulin | ||
|
||
- name: Generate code coverage | ||
run: cargo tarpaulin --verbose --workspace | ||
|
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,137 @@ | ||
name: Release | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: | ||
contents: write | ||
|
||
on: | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+-*" | ||
|
||
jobs: | ||
build: | ||
name: Build artifact | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- target: x86_64-unknown-linux-musl | ||
os: ubuntu-latest | ||
rust: stable | ||
- target: aarch64-unknown-linux-musl | ||
os: ubuntu-latest | ||
rust: stable | ||
- target: x86_64-apple-darwin | ||
os: macos-latest | ||
rust: stable | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
|
||
- name: Get release version number | ||
if: env.VERSION == '' | ||
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | ||
working-directory: cli-client | ||
|
||
- name: Check that tag version and Cargo.toml version are the same | ||
shell: bash | ||
run: | | ||
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then | ||
echo "version does not match Cargo.toml" >&2 | ||
exit 1 | ||
fi | ||
working-directory: cli-client | ||
|
||
- name: Install C compilation tooling (Linux) | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install clang gcc-aarch64-linux-gnu musl-tools -y | ||
working-directory: cli-client | ||
|
||
- name: Add rustup target | ||
run: rustup target add ${{ matrix.target }} | ||
working-directory: cli-client | ||
|
||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cross | ||
|
||
- name: Build release | ||
run: cross build --release --target ${{ matrix.target }} | ||
working-directory: cli-client | ||
|
||
- name: Create release directory | ||
run: mkdir -p artifacts/strikes-${{ env.VERSION }}-${{ matrix.target }} | ||
working-directory: cli-client | ||
|
||
- name: Move binary to release directory | ||
run: mv target/${{ matrix.target }}/release/strikes artifacts/strikes-${{ env.VERSION }}-${{ matrix.target }} | ||
working-directory: cli-client | ||
|
||
- name: Create tarball | ||
run: tar -czf ./artifacts/strikes-${{ env.VERSION }}-${{ matrix.target }}.tar.gz -C artifacts strikes-${{ env.VERSION }}-${{ matrix.target }} | ||
working-directory: cli-client | ||
|
||
- name: Upload tarball | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: strikes-${{ env.VERSION }}-${{ matrix.target }} | ||
path: ./cli-client/artifacts/strikes-${{ env.VERSION }}-${{ matrix.target }}.tar.gz | ||
|
||
release: | ||
name: Release artifacts | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get release version number | ||
if: env.VERSION == '' | ||
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | ||
|
||
- name: Debug | ||
uses: actions/download-artifact@v4 | ||
|
||
- name: List files | ||
run: ls -R | ||
|
||
- name: Download arm64 tarball | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: strikes-${{ env.VERSION }}-aarch64-unknown-linux-musl | ||
|
||
- name: Download x86_64_apple_darwin tarball | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: strikes-${{ env.VERSION }}-x86_64-apple-darwin | ||
|
||
- name: Download x86_64 tarball | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: strikes-${{ env.VERSION }}-x86_64-unknown-linux-musl | ||
|
||
- name: Release arm64 tarball | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
strikes-${{ env.VERSION }}-aarch64-unknown-linux-musl.tar.gz | ||
- name: Release x86_64_apple_darwin tarball | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
strikes-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz | ||
- name: Release x86_64 tarball | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
strikes-${{ env.VERSION }}-x86_64-unknown-linux-musl.tar.gz |
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 +1,33 @@ | ||
# Strikes | ||
|
||
## Usage | ||
- Add a strike to a user | ||
```bash | ||
strikes strike <user> | ||
``` | ||
|
||
- List all strikes | ||
```bash | ||
strikes ls | ||
``` | ||
|
||
## Use locally only | ||
You can use the local client without a remote server. | ||
It will generate a JSON file where the strikes are stored. | ||
The default path is in your home directory at '.strikes/db.json'. | ||
You can configure a different location by using the '--db-path' argument or by providing a configuration file. | ||
The argument has precedence over the configuration file. | ||
|
||
### Configuration file | ||
The configuration file needs to be a yaml file. | ||
|
||
```yaml | ||
db_path: /path/to/db.json | ||
``` | ||
The following command will create a database (db.json) in the current directory. | ||
```bash | ||
strikes --db-path ./my-db.json strike <user> | ||
``` | ||
|
Oops, something went wrong.