Skip to content

Commit

Permalink
refactor: move usage-lib into its own dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Mar 16, 2024
1 parent 8d2ce12 commit 3d1e4f0
Show file tree
Hide file tree
Showing 34 changed files with 168 additions and 232 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: publish-cli

permissions:
contents: write

on:
release:
types: [published]

concurrency:
group: release-${{ github.ref_name }}

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0

jobs:
publish-cli:
if: github.repository_owner == 'jdx' && startsWith(github.event.release.name, 'usage-v')
strategy:
matrix:
include:
- target: universal-apple-darwin
os: macos-14
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: usage
token: ${{ secrets.GITHUB_TOKEN }}
target: ${{ matrix.target }}
manifest-path: cli/Cargo.toml
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: true
bump-homebrew-formula:
runs-on: macos-14
timeout-minutes: 10
needs: [publish-cli]
continue-on-error: true
steps:
- name: Bump Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
token: ${{ secrets.GH_BOT_TOKEN }}
formula: usage
tap: jdx/homebrew-tap
19 changes: 0 additions & 19 deletions .github/workflows/release-please.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release-plz

permissions:
pull-requests: write
contents: write

on:
push:
branches:
- main

jobs:
release-plz:
runs-on: ubuntu-latest
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: MarcoIeni/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
97 changes: 0 additions & 97 deletions .github/workflows/release.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ run = 'cargo test --all --all-features'

[tasks.lint]
depends = ['lint:*']
[tasks."lint:prettier"]
run = "prettier -c ."
[tasks."lint:clippy"]
run = 'cargo clippy --all --all-features -- -D warnings'
[tasks."lint:fmt"]
Expand All @@ -46,6 +48,9 @@ run = [
'cargo fmt --all',
]

[tasks.format]
run = 'prettier -w .'

[tasks.ci]
depends = ['test', 'lint']

Expand Down
Empty file added .prettierrc.yml
Empty file.
3 changes: 0 additions & 3 deletions .release-please-manifest.json

This file was deleted.

15 changes: 0 additions & 15 deletions CHANGELOG.md

This file was deleted.

56 changes: 6 additions & 50 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,64 +1,20 @@
[package]
name = "usage-lib"
edition = "2021"
version = "0.1.9"
rust-version = "1.70.0"
include = [
"/Cargo.toml",
"/Cargo.lock",
"/README.md",
"/LICENSE",
"/src/**/*.rs",
]
description.workspace = true
homepage.workspace = true
documentation.workspace = true
authors.workspace = true
license.workspace = true

[workspace]
resolver = "2"
members = [
"cli",
"lib",
]

[workspace.package]
description = "Library for working with usage specs"
version = "0.1.9"
homepage = "https://usage.jdx.dev"
documentation = "https://github.com/jdx/usage"
authors = ["Jeff Dickey @jdx"]
license = "MIT"

[workspace.dependencies]
kdl = "4"

[lib]
name = "usage"

[dependencies]
clap = { version = "4", features = ["derive", "string"], optional = true }
heck = "0.5.0"
indexmap = { version = "2", features = ["serde"] }
itertools = "0.12"
log = "0.4"
kdl.workspace = true
miette = "5"
once_cell = "1"
serde = { version = "1", features = ["derive"] }
shell-escape = "0.1"
strum = { version = "0.26", features = ["derive"] }
thiserror = "1"
xx = "0.2"

[features]
default = ["clap"]

[dev-dependencies]
ctor = "0.2"
insta = "1"
usage-cli = { path = "cli" }
usage-lib = { path = "lib" }

[package.metadata.release]
[workspace.metadata.release]
allow-branch = ["main"]
sign-commit = true
sign-tag = true
shared-version = true
pre-release-hook = ["git", "cliff", "-o", "CHANGELOG.md", "--tag", "{{version}}" ]
24 changes: 12 additions & 12 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
name = "usage-cli"
edition = "2021"
repository = "https://github.com/jdx/usage"
version = "0.1.9"
license.workspace = true
authors.workspace = true
description.workspace = true
documentation.workspace = true
homepage.workspace = true
description = "CLI for working with usage-based CLIs"
version = { workspace = true }
license = { workspace = true }
authors = { workspace = true }
documentation = { workspace = true }
homepage = { workspace = true }
include = [
"/Cargo.toml",
"/Cargo.lock",
"/README.md",
"/LICENSE",
"/src/**/*.rs",
]

Expand All @@ -32,7 +31,7 @@ exec = "0.3"
heck = "0.5.0"
indexmap = "2"
itertools = "0.12"
kdl.workspace = true
kdl = "4"
log = "0.4"
miette = { version = "5", features = ["fancy"] }
once_cell = "1"
Expand All @@ -41,20 +40,21 @@ serde = { version = "1", features = ["derive"] }
strum = { version = "0.26", features = ["derive"] }
tera = "1"
thiserror = "1"
usage-lib = { path = "..", version = "0.1.9", features = ["clap"] }
usage-lib = { workspace = true }
xx = "0.2"

[dev-dependencies]
assert_cmd = { version = "2", features = ["color-auto"] }
ctor = "0.2"
predicates = "3"

[package.metadata.release]
shared-version = true

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/usage-{target}{ archive-suffix }"
[package.metadata.binstall.overrides.aarch64-apple-darwin]
pkg-url = "{ repo }/releases/download/v{ version }/usage-universal-apple-darwin{ archive-suffix }"
[package.metadata.binstall.overrides.x86_64-apple-darwin]
pkg-url = "{ repo }/releases/download/v{ version }/usage-universal-apple-darwin{ archive-suffix }"

[package.metadata.release]
shared-version = true
release = true
19 changes: 0 additions & 19 deletions cli/LICENSE

This file was deleted.

Loading

0 comments on commit 3d1e4f0

Please sign in to comment.