Skip to content

Commit

Permalink
feat: Ledger device support (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamspofford-dfinity authored Jun 14, 2023
1 parent ad7c4e2 commit 68ab412
Show file tree
Hide file tree
Showing 154 changed files with 1,883 additions and 384 deletions.
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Fixes # (issue)

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

# Checklist:
# Checklist

- [ ] I have made corresponding changes to the documentation in src/docs.
- [ ] I have made corresponding changes to the documentation in docs/cli-reference.
- [ ] I have added corresponding integration tests.
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
command: cargo clippy --all --all-targets --all-features --tests -- -D warnings
- name: Test
command: cargo test
include:
- os: ubuntu-latest
build_deps: scripts/workflows/provision-linux-build.sh
- os: macos-latest
build_deps: scripts/workflows/provision-darwin-build.sh
- os: windows-latest
build_deps: scripts/workflows/provision-windows-build.ps1
env:
VCPKG_ROOT: 'C:\vcpkg'
steps:
Expand All @@ -34,14 +41,8 @@ jobs:
${{ env.VCPKG_ROOT }}
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ env.rust }}-ci-1

- name: Install dependencies (windows only)
if: ${{ contains(matrix.os, 'windows') }}
shell: bash
run: |
vcpkg integrate install
vcpkg install openssl:x64-windows-static-md
echo "OPENSSL_DIR=C:\vcpkg\installed\x64-windows-static-md" >> $GITHUB_ENV
echo "OPENSSL_STATIC=Yes" >> $GITHUB_ENV
- name: Install dependencies
run: ${{ matrix.build_deps }}

- uses: actions-rs/toolchain@v1
with:
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ jobs:
fail-fast: false
matrix:
# windows not supported by dfx
os: [ubuntu-latest, macos-latest]
binary_path: ["target/release"]
include:
- os: ubuntu-latest
binary_path: target/release
build_deps: scripts/workflows/provision-linux-build.sh
- os: macos-latest
binary_path: target/release
build_deps: scripts/workflows/provision-darwin-build.sh
steps:
- uses: actions/checkout@master

Expand All @@ -36,6 +41,8 @@ jobs:
toolchain: ${{ env.rust }}
override: true
# components: rustfmt, clippy
- name: Install dependencies
run: ${{ matrix.build_deps }}

- name: Build release
run: cargo build --release --locked
Expand Down Expand Up @@ -78,10 +85,10 @@ jobs:
run: chmod +x /usr/local/bin/quill
- name: Provision Darwin
if: ${{ contains(matrix.os, 'macos') }}
run: bash scripts/workflows/provision-darwin.sh
run: bash scripts/workflows/provision-darwin-e2e.sh
- name: Provision Linux
if: ${{ contains(matrix.os, 'ubuntu') }}
run: bash scripts/workflows/provision-linux.sh
run: bash scripts/workflows/provision-linux-e2e.sh
- name: Prepare environment
run: |
echo "archive=$(pwd)/e2e/archive" >> "$GITHUB_ENV"
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,24 @@ jobs:
name: windows
target_file: target/release/quill.exe
asset_name: quill-windows-x86_64.exe
build_deps: scripts/workflows/provision-windows-build.ps1
- os: macos-latest
name: macos
target_file: target/release/quill
asset_name: quill-macos-x86_64
build_deps: scripts/workflows/provision-darwin-build.sh
- os: ubuntu-latest
name: linux-arm32
target: arm-unknown-linux-gnueabihf
cross: true
target_file: target/arm-unknown-linux-gnueabihf/release-arm/quill
asset_name: quill-linux-arm32
features: [static-ssl, hsm]
- os: ubuntu-latest
name: linux
target_file: target/release/quill
asset_name: quill-linux-x86_64
build_deps: scripts/workflows/provision-linux-build.sh
env:
VCPKG_ROOT: 'C:\vcpkg'
steps:
Expand All @@ -55,14 +59,9 @@ jobs:
${{ env.VCPKG_ROOT }}
key: ${{ matrix.os }}-cargo-${{ env.rust }}-release-1

- name: Install dependencies (windows only)
if: ${{ contains(matrix.os, 'windows') }}
shell: bash
run: |
vcpkg integrate install
vcpkg install openssl:x64-windows-static-md
echo "OPENSSL_DIR=C:\vcpkg\installed\x64-windows-static-md" >> $GITHUB_ENV
echo "OPENSSL_STATIC=Yes" >> $GITHUB_ENV
- name: Install dependencies
if: ${{ matrix.build_deps }}
run: ${{ matrix.build_deps }}

- name: Install toolchain
uses: actions-rs/toolchain@v1
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Added Ledger support via `--ledger`. (#199)
- Added `--confirmation-text` to `quill sns pay`. (#195)
- Fixed `quill ckbtc update-balance` allowing the anonymous principal. (#191)
- Added `disburse`, `disburse-maturity`, `split-neuron`, and `follow-neuron` to `quill sns`. (#191)
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ All code contributions are subject to our [Contributor License Agreement (CLA)](
Quill has three kinds of tests to be aware of:

- Rust unit tests. Add these whenever internal helpers are added or changed, using standard Rust test conventions.
- Output tests. These are located in `tests/output-tests`. Add these whenever the command interface is updated. Each test is an integration test dry-running a `quill` command; its output is checked against a file in `outputs`. Set `FIX_OUTPUTS=1` when running `cargo test` to generate this file for a new test. Ensure that the output contains Candid field names rather than field hashes.
- Output tests. These are located in `tests/output`. Add these whenever the command interface is updated. Each test is an integration test dry-running a `quill` command; its output is checked against a file in `default`. Set `FIX_OUTPUTS=1` when running `cargo test` to generate this file for a new test. Ensure that the output contains Candid field names rather than field hashes.
- Some output tests require a Ledger device. To run these tests, a Ledger Nano should be plugged in and initialized with the seed "equip will roof matter pink blind book anxiety banner elbow sun young", and the ICP app must be installed. Then run `cargo test -- --ignored` and accept each request on the device. These tests are manually run so if you do not own a Ledger device you will need to wait for the reviewer to notify you of test failures.
- End-to-end tests. These are located in `e2e/tests-quill`. These should be added whenever a test needs to be run against a real replica. They are run with [`bats`](https://github.com/bats-core/bats-core), and you will need to install [`dfx`](https://github.com/dfinity/sdk) and [`bats-support`](https://github.com/ztombol/bats-support), and point the `BATSLIB` environment variable to the `bats-support` installation path. More examples of writing tests for our E2E test setup can be found in the [SDK repository](https://github.com/dfinity/sdk).

The latter two require you to have run `cargo build` before executing them.

## Documentation

Every change to the command-line interface must contain documentation; we use `clap`, so Rustdoc comments turn into CLI documentation. Additionally, this in-code documentation must be mirrored by a corresponding change in `docs/cli-reference`. See existing doc pages for examples. Finally, any feature or notable bugfix should be mentioned in [CHANGELOG.md](CHANGELOG.md), under the `## Unreleased` header.
Expand Down
Loading

0 comments on commit 68ab412

Please sign in to comment.