]> Untitled Git - bdk-cli/commitdiff
[ci] Add audit, ci, and code coverage workflows
authorSteve Myers <steve@notmandatory.org>
Mon, 28 Dec 2020 05:06:30 +0000 (21:06 -0800)
committerSteve Myers <steve@notmandatory.org>
Mon, 28 Dec 2020 05:06:30 +0000 (21:06 -0800)
.github/workflows/audit.yml [new file with mode: 0644]
.github/workflows/code_coverage.yml [new file with mode: 0644]
.github/workflows/cont_integration.yml [new file with mode: 0644]

diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml
new file mode 100644 (file)
index 0000000..6143cca
--- /dev/null
@@ -0,0 +1,19 @@
+name: Audit
+
+on:
+  push:
+    paths:
+      - '**/Cargo.toml'
+      - '**/Cargo.lock'
+  schedule:
+    - cron: '0 0 * * 0' # Once per week
+
+jobs:
+
+  security_audit:
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/audit-check@v1
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml
new file mode 100644 (file)
index 0000000..5dafb06
--- /dev/null
@@ -0,0 +1,27 @@
+on: [push]
+
+name: Code Coverage
+
+jobs:
+  tarpaulin-codecov:
+    name: Tarpaulin to codecov.io
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Set default toolchain
+        run: rustup default nightly
+      - name: Set profile
+        run: rustup set profile minimal
+
+      - name: Install tarpaulin
+        run: cargo install cargo-tarpaulin
+      - name: Tarpaulin
+        run: cargo tarpaulin --features default,esplora --run-types Tests,Doctests --out Xml
+
+      - name: Publish to codecov.io
+        uses: codecov/codecov-action@v1.0.15
+        with:
+          fail_ci_if_error: true
+          file: ./cobertura.xml
diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml
new file mode 100644 (file)
index 0000000..c5e7536
--- /dev/null
@@ -0,0 +1,57 @@
+on: [push, pull_request]
+
+name: CI
+
+jobs:
+
+  build-test:
+    name: Build and test
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        rust:
+          - stable
+          - 1.45.0 # MSRV
+        features:
+          - default
+          - default,esplora
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Generate cache key
+        run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key
+      - name: Cache
+        uses: actions/cache@v2
+        with:
+          path: |
+            ~/.cargo/registry
+            ~/.cargo/git
+            target
+          key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
+      - name: Set default toolchain
+        run: rustup default ${{ matrix.rust }}
+      - name: Set profile
+        run: rustup set profile minimal
+      - name: Add clippy
+        run: rustup component add clippy
+      - name: Build
+        run: cargo build --features ${{ matrix.features }} --no-default-features
+      - name: Clippy
+        run: cargo clippy -- -D warnings
+      - name: Test
+        run: cargo test --features ${{ matrix.features }} --no-default-features
+
+  fmt:
+    name: Rust fmt
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set default toolchain
+        run: rustup default stable
+      - name: Set profile
+        run: rustup set profile minimal
+      - name: Add clippy
+        run: rustup component add rustfmt
+      - name: Check fmt
+        run: cargo fmt --all -- --check