Skip to content

Commit 952d996

Browse files
authored
Merge pull request #93 from YOU54F/feat/rename-cli-bin-to-pact-plugin
feat: rename cli bin from pact-plugin-cli to pact-plugin
2 parents b598525 + 77baf74 commit 952d996

42 files changed

Lines changed: 2621 additions & 1486 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/examples.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
name: Pact Plugin Examples
22

33
on:
4-
- push
5-
- pull_request
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
610

711
jobs:
812
csv-examples:
913
runs-on: ${{ matrix.operating-system }}
1014
strategy:
15+
fail-fast: false
1116
matrix:
12-
operating-system: [ ubuntu-latest, windows-latest, macos-13 ]
17+
operating-system: [ ubuntu-latest, windows-latest, macos-latest ]
1318
env:
1419
PACT_DO_NOT_TRACK: true
1520
RUST_LOG: trace
@@ -78,8 +83,9 @@ jobs:
7883
protobuf-examples:
7984
runs-on: ${{ matrix.operating-system }}
8085
strategy:
86+
fail-fast: false
8187
matrix:
82-
operating-system: [ ubuntu-latest, windows-latest, macos-13 ]
88+
operating-system: [ ubuntu-latest, windows-latest, macos-latest ]
8389
env:
8490
PACT_DO_NOT_TRACK: true
8591
RUST_LOG: trace
@@ -100,7 +106,7 @@ jobs:
100106
- name: Install Go
101107
uses: actions/setup-go@v2
102108
with:
103-
go-version: 1.19.x
109+
go-version: 1.23.x
104110
- name: Install plugin cli
105111
run: scripts/install-plugin-cli.sh
106112
shell: bash
@@ -170,8 +176,9 @@ jobs:
170176
grpc-examples:
171177
runs-on: ${{ matrix.operating-system }}
172178
strategy:
179+
fail-fast: false
173180
matrix:
174-
operating-system: [ ubuntu-latest, windows-latest, macos-13 ]
181+
operating-system: [ ubuntu-latest, windows-latest, macos-15-intel ]
175182
env:
176183
PACT_DO_NOT_TRACK: true
177184
RUST_LOG: trace
@@ -192,7 +199,7 @@ jobs:
192199
- name: Install Go
193200
uses: actions/setup-go@v2
194201
with:
195-
go-version: 1.19.x
202+
go-version: 1.23.x
196203
- name: Install plugin cli
197204
run: scripts/install-plugin-cli.sh
198205
shell: bash
@@ -209,23 +216,23 @@ jobs:
209216
if: runner.os == 'macOS'
210217
- name: Install Pact Go (Linux)
211218
run: |
212-
go install github.com/pact-foundation/pact-go/v2@2.x.x
219+
go install github.com/pact-foundation/pact-go/v2@latest
213220
sudo $HOME/go/bin/pact-go -l DEBUG install
214221
sudo chmod 644 /usr/local/lib/libpact_ffi.so
215222
ls -la /usr/local/lib/
216223
shell: bash
217224
if: runner.os == 'Linux'
218225
- name: Install Pact Go (OSX)
219226
run: |
220-
go install github.com/pact-foundation/pact-go/v2@2.x.x
221-
$HOME/go/bin/pact-go -l DEBUG install
227+
go install github.com/pact-foundation/pact-go/v2@latest
228+
sudo $HOME/go/bin/pact-go -l DEBUG install
222229
shell: bash
223230
if: runner.os == 'macOS'
224231
- name: Install Pact Go (Windows)
225232
run: |
226-
go install github.com/pact-foundation/pact-go/v2@2.x.x
233+
go install github.com/pact-foundation/pact-go/v2@latest
227234
#$HOME/go/bin/pact-go -l DEBUG install
228-
curl -L -o ~/.pact/pact_ffi.dll.gz https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v0.4.5/pact_ffi-windows-x86_64.dll.gz
235+
curl -L -o ~/.pact/pact_ffi.dll.gz https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v0.4.28/pact_ffi-windows-x86_64.dll.gz
229236
gunzip -N -f ~/.pact/pact_ffi.dll.gz
230237
cp ~/.pact/pact_ffi.dll examples/gRPC/area_calculator/consumer-go
231238
shell: bash

.github/workflows/gradle.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
name: Pact Plugin Driver (Gradle)
22

33
on:
4-
- push
5-
- pull_request
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
610

711
jobs:
812
latest_jdk:
913
runs-on: ${{ matrix.operating-system }}
1014
strategy:
15+
fail-fast: false
1116
matrix:
12-
operating-system: [ ubuntu-latest, windows-latest, macos-13 ]
17+
operating-system: [ ubuntu-latest, windows-latest, macos-latest ]
1318
steps:
1419
- uses: actions/checkout@v4
1520
- name: Set up JDK 21

.github/workflows/plugin-cli.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
name: Pact Plugin CLI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
410

511
jobs:
612
build:
713
runs-on: ${{ matrix.operating-system }}
814
strategy:
15+
fail-fast: false
916
matrix:
10-
operating-system: [ ubuntu-latest, windows-latest, macos-13 ]
17+
operating-system: [ ubuntu-latest, windows-latest, macos-latest ]
1118
steps:
1219
- uses: actions/checkout@v3
1320
- uses: actions-rs/toolchain@v1
@@ -25,5 +32,5 @@ jobs:
2532
run: cargo test
2633
working-directory: cli
2734
- name: Test installing plugin
28-
run: ./target/debug/pact-plugin-cli -y -d install csv
35+
run: ./target/debug/pact-plugin -y -d install csv
2936
working-directory: cli

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ jobs:
1818
strategy:
1919
matrix:
2020
include:
21-
- operating-system: ubuntu-20.04
21+
- operating-system: ubuntu-22.04
2222
targets: x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,aarch64-unknown-linux-gnu,aarch64-unknown-linux-musl
23-
- operating-system: windows-2019
23+
- operating-system: windows-latest
2424
targets: aarch64-pc-windows-msvc,x86_64-pc-windows-msvc
25-
- operating-system: macos-13
25+
- operating-system: macos-latest
2626
targets: aarch64-apple-darwin,x86_64-apple-darwin
2727
fail-fast: false
2828
env:

.github/workflows/rust.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
name: Pact Plugin Driver (Rust)
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
410

511
jobs:
612
build:
713
runs-on: ${{ matrix.operating-system }}
814
strategy:
15+
fail-fast: false
916
matrix:
10-
operating-system: [ ubuntu-latest, windows-latest, macos-13 ]
17+
operating-system: [ ubuntu-latest, windows-latest, macos-latest ]
1118
env:
1219
pact_do_not_track: true
1320
steps:

cli/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ This project provides a command line interface to manage and install Pact plugin
44

55
## Command line interface
66

7-
Running `pact-plugin-cli` without any options displays the standard help.
7+
Running `pact-plugin` without any options displays the standard help.
88

99
```console,ignore
10-
$ pact-plugin-cli
10+
$ pact-plugin
1111
CLI utility for Pact plugins
1212
13-
Usage: pact-plugin-cli [OPTIONS] <COMMAND>
13+
Usage: pact-plugin [OPTIONS] <COMMAND>
1414
1515
Commands:
1616
list List installed plugins
@@ -35,7 +35,7 @@ Options:
3535
The `env` command will display any environment configuration that is being used.
3636

3737
```console,ignore
38-
$ pact-plugin-cli env
38+
$ pact-plugin env
3939
┌──────────────────┬─────────────────────┬────────────────────────────┐
4040
│ Configuration ┆ Source ┆ Value │
4141
╞══════════════════╪═════════════════════╪════════════════════════════╡
@@ -49,7 +49,7 @@ $ pact-plugin-cli env
4949
Running the `list` command will list installed plugins.
5050

5151
```console,ignore
52-
$ pact-plugin-cli list
52+
$ pact-plugin list
5353
┌──────────┬─────────┬───────────────────┬───────────────────────────────────────────┬─────────┐
5454
│ Name ┆ Version ┆ Interface Version ┆ Directory ┆ Status │
5555
╞══════════╪═════════╪═══════════════════╪═══════════════════════════════════════════╪═════════╡
@@ -64,10 +64,10 @@ $ pact-plugin-cli list
6464
The `disable` command will disable a version of a plugin, while the `enable` command will enable it again.
6565

6666
```console
67-
$ pact-plugin-cli enable --help
67+
$ pact-plugin enable --help
6868
Enable a plugin version
6969

70-
Usage: pact-plugin-cli enable <NAME> [VERSION]
70+
Usage: pact-plugin enable <NAME> [VERSION]
7171

7272
Arguments:
7373
<NAME> Plugin name
@@ -86,10 +86,10 @@ A particular version of a plugin can be removed with the `remove` command. It re
8686
If there is only a single version, the version value can be omitted.
8787

8888
```console
89-
$ pact-plugin-cli remove --help
89+
$ pact-plugin remove --help
9090
Remove a plugin
9191

92-
Usage: pact-plugin-cli remove [OPTIONS] <NAME> [VERSION]
92+
Usage: pact-plugin remove [OPTIONS] <NAME> [VERSION]
9393

9494
Arguments:
9595
<NAME> Plugin name
@@ -104,7 +104,7 @@ Options:
104104
This will prompt to confirm the removal of the plugin, but that can be overridden with the `-y,-yes` option.
105105

106106
```console,ignore
107-
$ pact-plugin-cli -y remove csv
107+
$ pact-plugin -y remove csv
108108
Removed plugin with name 'csv' and version '0.0.1'
109109
```
110110

@@ -115,12 +115,12 @@ operating system and architecture required. If there are SHA256 digests of the d
115115
against the downloaded one.
116116

117117
```console
118-
$ pact-plugin-cli install --help
118+
$ pact-plugin install --help
119119
Install a plugin
120120

121121
A plugin can be either installed from a URL, or for a known plugin, by name (and optionally version).
122122

123-
Usage: pact-plugin-cli install [OPTIONS] <SOURCE>
123+
Usage: pact-plugin install [OPTIONS] <SOURCE>
124124

125125
Arguments:
126126
<SOURCE>
@@ -163,7 +163,7 @@ To skip installing the plugin if the version is already installed, use the `-s,
163163
Example of installing the CSV plugin:
164164

165165
```console,ignore
166-
$ pact-plugin-cli -y install https://github.com/pact-foundation/pact-plugins/releases/tag/csv-plugin-0.0.1
166+
$ pact-plugin -y install https://github.com/pact-foundation/pact-plugins/releases/tag/csv-plugin-0.0.1
167167
Installing plugin csv version 0.0.1
168168
Downloaded https://github.com/pact-foundation/pact-plugins/releases/download/csv-plugin-0.0.1/pact-csv-plugin-linux-x86_64.gz to /home/ronald/.pact/plugins/csv-0.0.1/pact-csv-plugin-linux-x86_64.gz
169169
[00:00:03] [#######################################################################################################################################################################] 3.43MiB/3.43MiB (973.64KiB/s, 0s)
@@ -179,7 +179,7 @@ The CLI executable can be downloaded from the GitHub release page (i.e., https:/
179179
There will be a file for each major OS and architecture. It just needs to be unzipped (using gunzip) and made executable on Unix.
180180

181181
```console,ignore
182-
❯ wget https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v0.0.0/pact-plugin-cli-linux-x86_64.gz
182+
❯ wget https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v0.0.0/pact-plugin-linux-x86_64.gz
183183
--2022-06-03 13:45:17-- https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v0.0.0/pact-plugin-cli-linux-x86_64.gz
184184
Resolving github.com (github.com)... 52.64.108.95
185185
Connecting to github.com (github.com)|52.64.108.95|:443... connected.

cli/release.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ then
1717
fi
1818

1919
echo Building Release for "$1"
20-
APP=pact-plugin-cli
20+
APP=pact-plugin
2121
OS=$1
2222
shift;
2323
# All flags passed to this script are passed to cargo.
@@ -52,12 +52,10 @@ build_linux_aarch64() {
5252
# Build the x86_64 darwin release
5353
build_macos_x86_64() {
5454
#cargo clean
55+
export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-12}
5556
cargo build --target x86_64-apple-darwin "${cargo_flags[@]}"
5657

5758
if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
58-
gzip_and_sum \
59-
"$CARGO_TARGET_DIR/x86_64-apple-darwin/release/${APP}" \
60-
"$ARTIFACTS_DIR/${APP}-osx-x86_64.gz"
6159
gzip_and_sum \
6260
"$CARGO_TARGET_DIR/x86_64-apple-darwin/release/${APP}" \
6361
"$ARTIFACTS_DIR/${APP}-macos-x86_64.gz"
@@ -67,12 +65,10 @@ build_macos_x86_64() {
6765
# Build the aarch64 darwin release
6866
build_macos_aarch64() {
6967
#cargo clean
68+
export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-12}
7069
cargo build --target aarch64-apple-darwin "${cargo_flags[@]}"
7170

7271
if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
73-
gzip_and_sum \
74-
"$CARGO_TARGET_DIR/aarch64-apple-darwin/release/${APP}" \
75-
"$ARTIFACTS_DIR/${APP}-osx-aarch64.gz"
7672
gzip_and_sum \
7773
"$CARGO_TARGET_DIR/aarch64-apple-darwin/release/${APP}" \
7874
"$ARTIFACTS_DIR/${APP}-macos-aarch64.gz"

cli/src/bin/pact-plugin.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use std::process::ExitCode;
2+
3+
use tracing::Level;
4+
use pact_plugin_cli::{Cli, handle_matches, setup_logger};
5+
use clap::Parser;
6+
7+
fn main() -> Result<(), ExitCode> {
8+
let cli = Cli::parse();
9+
10+
let log_level = if cli.trace {
11+
Level::TRACE
12+
} else if cli.debug {
13+
Level::DEBUG
14+
} else {
15+
Level::WARN
16+
};
17+
setup_logger(log_level);
18+
handle_matches(&cli)
19+
}

0 commit comments

Comments
 (0)