Skip to content

Commit 34eb526

Browse files
authored
Merge pull request #3 from thesis/cli
cli: merge the binary and library crates
2 parents ce62b9e + 9c346dd commit 34eb526

14 files changed

Lines changed: 88 additions & 54 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ jobs:
5252
git clone https://github.com/FiloSottile/passage
5353
sudo make -C passage install PREFIX=/usr/local
5454
- name: Build plugin binary
55-
run: cargo build -p age-plugin-argon2-cli
55+
run: cargo build -p age-plugin-argon2
5656
- name: Run e2e tests
57-
run: cargo test -p age-plugin-argon2-cli --features e2e --test e2e
57+
run: cargo test -p age-plugin-argon2 --features e2e --test e2e
5858

5959
deny:
6060
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
push:
5-
tags: ["age-plugin-argon2-v*"]
5+
tags: ["v*"]
66

77
permissions:
88
contents: write
@@ -11,7 +11,60 @@ env:
1111
CARGO_TERM_COLOR: always
1212

1313
jobs:
14+
build:
15+
name: Build ${{ matrix.target }}
16+
strategy:
17+
matrix:
18+
include:
19+
- target: x86_64-unknown-linux-musl
20+
os: ubuntu-latest
21+
- target: x86_64-apple-darwin
22+
os: macos-latest
23+
- target: aarch64-apple-darwin
24+
os: macos-latest
25+
- target: x86_64-pc-windows-msvc
26+
os: windows-latest
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: dtolnay/rust-toolchain@stable
31+
with:
32+
targets: ${{ matrix.target }}
33+
- uses: Swatinem/rust-cache@v2
34+
35+
- name: Install musl tools
36+
if: matrix.target == 'x86_64-unknown-linux-musl'
37+
run: sudo apt-get install -y musl-tools
38+
39+
- name: Build
40+
run: cargo build -p age-plugin-argon2 --release --target ${{ matrix.target }}
41+
42+
- name: Package (Unix)
43+
if: runner.os != 'Windows'
44+
run: |
45+
VERSION="${GITHUB_REF_NAME#age-plugin-argon2-}"
46+
ARCHIVE="age-plugin-argon2-${VERSION}-${{ matrix.target }}.tar.gz"
47+
tar czf "$ARCHIVE" -C "target/${{ matrix.target }}/release" age-plugin-argon2
48+
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
49+
50+
- name: Package (Windows)
51+
if: runner.os == 'Windows'
52+
shell: pwsh
53+
run: |
54+
$version = $env:GITHUB_REF_NAME -replace '^age-plugin-argon2-', ''
55+
$archive = "age-plugin-argon2-${version}-${{ matrix.target }}.zip"
56+
Compress-Archive `
57+
-Path "target/${{ matrix.target }}/release/age-plugin-argon2.exe" `
58+
-DestinationPath $archive
59+
echo "ARCHIVE=$archive" | Out-File -FilePath $env:GITHUB_ENV -Append
60+
61+
- uses: actions/upload-artifact@v4
62+
with:
63+
name: ${{ matrix.target }}
64+
path: ${{ env.ARCHIVE }}
65+
1466
publish:
67+
needs: build
1568
runs-on: ubuntu-latest
1669
steps:
1770
- uses: actions/checkout@v4
@@ -26,7 +79,20 @@ jobs:
2679
env:
2780
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
2881

82+
release:
83+
needs: [build, publish]
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/download-artifact@v4
87+
with:
88+
path: artifacts
89+
merge-multiple: true
90+
2991
- name: Create GitHub release
30-
run: gh release create "${{ github.ref_name }}" --generate-notes
92+
run: |
93+
gh release create "${{ github.ref_name }}" \
94+
--repo "${{ github.repository }}" \
95+
--generate-notes \
96+
artifacts/*
3197
env:
3298
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Cargo.lock

Lines changed: 4 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[workspace]
2-
members = ["age-plugin-argon2", "age-plugin-argon2-cli"]
2+
members = ["age-plugin-argon2"]
33
resolver = "2"

age-plugin-argon2-cli/Cargo.toml

Lines changed: 0 additions & 33 deletions
This file was deleted.

age-plugin-argon2/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,21 @@ readme = "../README.md"
99
categories = ["cryptography", "authentication"]
1010
keywords = ["age", "argon2", "encryption", "password", "plugin"]
1111

12+
[features]
13+
e2e = []
14+
15+
[[test]]
16+
name = "e2e"
17+
required-features = ["e2e"]
18+
1219
[dependencies]
1320
age-core = "0.11"
1421
age = "0.11"
22+
age-plugin = "0.6"
1523
argon2 = { version = "0.5", features = ["std"] }
24+
bech32 = "0.9"
1625
chacha20poly1305 = "0.10"
26+
clap = { version = "4", features = ["derive"] }
1727
rand = { version = "0.8", features = ["std_rng"] }
1828
base64 = "0.22"
1929
uuid = { version = "1", features = ["v4"] }
@@ -28,3 +38,6 @@ thiserror = "1.0"
2838
[dev-dependencies]
2939
serde_json = "1.0"
3040
tempfile = "3"
41+
42+
[target.'cfg(unix)'.dev-dependencies]
43+
rexpect = "0.6"

age-plugin-argon2-cli/src/commands/generate.rs renamed to age-plugin-argon2/src/bin/age-plugin-argon2/commands/generate.rs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)