ebbf043bc9
This commit contains a "big bang" refactor/rewrite which does the following: - Replaces all `SCard*` FFI calls with the `pcsc` crate, which provides a safe, portable PC/SC API across Windows, macOS, and Linux - Refactors the `util` module into modules representing the various device functions and concepts, e.g. `certificate`, `key`, `mgm` - Replaces all usage of `libc` with `std` functionality, and in many places rewriting functionality to use safe code. - Removes `ykpiv_` from all function names, and `Piv*` from type names. In 20/20 hindsight I wish I had done this commit more incrementally so as to make it easier to review. Que sera sera. However, realistically we need to test all functionality on the device to ensure that it actually works. Going forward I would like to put pretty much all of the current code behind an `untested` cargo feature, and then remove it for each bit of functionality we test.
160 lines
3.5 KiB
YAML
160 lines
3.5 KiB
YAML
# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
|
|
|
|
on:
|
|
pull_request: {}
|
|
push:
|
|
branches: master
|
|
|
|
name: Rust
|
|
|
|
jobs:
|
|
check:
|
|
name: Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Install libpcsclite-dev
|
|
run: sudo apt-get install libpcsclite-dev
|
|
|
|
- name: Run cargo check
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
|
|
# Need to install `libpscslite-dev` on Linux
|
|
linux:
|
|
name: Test Suite
|
|
strategy:
|
|
matrix:
|
|
toolchain:
|
|
- 1.39.0
|
|
- stable
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.toolchain }}
|
|
override: true
|
|
|
|
- name: Install libpcsclite-dev
|
|
run: sudo apt-get install libpcsclite-dev
|
|
|
|
- name: Run cargo test
|
|
uses: actions-rs/cargo@v1
|
|
env:
|
|
RUSTFLAGS: -D warnings
|
|
with:
|
|
command: test
|
|
args: --release
|
|
|
|
test:
|
|
name: Test Suite
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- macos-latest
|
|
- windows-latest
|
|
toolchain:
|
|
- 1.39.0
|
|
- stable
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.toolchain }}
|
|
override: true
|
|
|
|
- name: Run cargo test
|
|
uses: actions-rs/cargo@v1
|
|
env:
|
|
RUSTFLAGS: -D warnings
|
|
with:
|
|
command: test
|
|
args: --release
|
|
|
|
fmt:
|
|
name: Rustfmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Install rustfmt
|
|
run: rustup component add rustfmt
|
|
|
|
- name: Run cargo fmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
|
|
clippy:
|
|
name: Clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Install libpcsclite-dev
|
|
run: sudo apt-get install libpcsclite-dev
|
|
|
|
- name: Install clippy
|
|
run: rustup component add clippy
|
|
|
|
- name: Run cargo clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: -- -D warnings
|
|
|
|
# TODO: use actions-rs/audit-check
|
|
security_audit:
|
|
name: Security Audit
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Install cargo audit
|
|
run: cargo install cargo-audit
|
|
|
|
- name: Run cargo audit
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: audit
|
|
args: --deny-warnings
|