[ci] Consolidate build, test, clippy jobs

This commit is contained in:
Steve Myers 2020-10-06 22:38:26 -07:00
parent 8e7b195e93
commit 6402fd07c2
No known key found for this signature in database
GPG Key ID: 8105A46B22C2D051

View File

@ -4,40 +4,14 @@ name: Continuous integration
jobs: jobs:
test: build-test:
name: Test Default name: Build and Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
rust: rust:
- stable - stable
- 1.45.0 # MSRV - 1.45.0 # MSRV
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check
- uses: actions-rs/cargo@v1
with:
command: test
check-features:
name: Check Features
runs-on: ubuntu-latest
strategy:
matrix:
features: features:
- minimal - minimal
- all-keys - all-keys
@ -46,46 +20,58 @@ jobs:
- electrum - electrum
- compact_filters - compact_filters
- cli-utils,esplora - cli-utils,esplora
- compiler
include:
- rust: stable
features: default
clippy: false
test: true
- rust: 1.45.0
features: default
test: true
- rust: nightly
features: test-md-docs
test: true
- rust: stable
features: compiler
test: true
- rust: 1.45.0
features: compiler
test: true
steps: steps:
- uses: actions/checkout@v2 - name: checkout
- uses: actions/cache@v2 uses: actions/checkout@v2
- name: cache
uses: actions/cache@v2
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
target target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1 - name: toolchain
uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: 1.45.0 # MSRV toolchain: ${{ matrix.rust }}
override: true override: true
- uses: actions-rs/cargo@v1 - name: build
uses: actions-rs/cargo@v1
with: with:
command: check command: build
args: --features ${{ matrix.features }} --no-default-features args: --features ${{ matrix.features }} --no-default-features
- name: clippy
test-compiler: if: ${{ matrix.clippy == true }}
name: Test Compiler uses: actions-rs/cargo@v1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with: with:
path: | command: clippy
~/.cargo/registry args: -- -D warnings
~/.cargo/git - name: test
target if: ${{ matrix.test == true }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} uses: actions-rs/cargo@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.45.0 # MSRV
override: true
- uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --features compiler --no-default-features args: --features ${{ matrix.features }} --no-default-features
test-electrum: test-electrum:
name: Test Electrum name: Test Electrum
@ -94,47 +80,30 @@ jobs:
MAGICAL_RPC_COOKIEFILE: /home/runner/.bitcoin/regtest/.cookie MAGICAL_RPC_COOKIEFILE: /home/runner/.bitcoin/regtest/.cookie
MAGICAL_ELECTRUM_URL: tcp://127.0.0.1:60401 MAGICAL_ELECTRUM_URL: tcp://127.0.0.1:60401
steps: steps:
- uses: actions/checkout@v2 - name: checkout
- uses: actions/cache@v2 uses: actions/checkout@v2
- name: cache
uses: actions/cache@v2
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
target target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1 - name: toolchain
uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: 1.45.0 # MSRV toolchain: stable
override: true override: true
- run: ./ci/start-core.sh || exit 1 - name: start core
- uses: actions-rs/cargo@v1 run: ./ci/start-core.sh || exit 1
- name: test
uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --features test-electrum --no-default-features args: --features test-electrum --no-default-features
test-md-docs:
name: Test MD Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --features test-md-docs --no-default-features
check-wasm: check-wasm:
name: Check WASM name: Check WASM
runs-on: ubuntu-16.04 runs-on: ubuntu-16.04
@ -142,8 +111,10 @@ jobs:
CC: clang-10 CC: clang-10
CFLAGS: -I/usr/include CFLAGS: -I/usr/include
steps: steps:
- uses: actions/checkout@v2 - name: checkout
- uses: actions/cache@v2 uses: actions/checkout@v2
- name: cache
uses: actions/cache@v2
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
@ -155,46 +126,34 @@ jobs:
- run: sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" || exit 1 - run: sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" || exit 1
- run: sudo apt-get update || exit 1 - run: sudo apt-get update || exit 1
- run: sudo apt-get install -y clang-10 libc6-dev-i386 || exit 1 - run: sudo apt-get install -y clang-10 libc6-dev-i386 || exit 1
- uses: actions-rs/toolchain@v1 - name: toolchain
uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: 1.45.0 # MSRV toolchain: stable
target: wasm32-unknown-unknown target: wasm32-unknown-unknown
override: true override: true
- uses: actions-rs/cargo@v1 - name: check
uses: actions-rs/cargo@v1
with: with:
command: check command: check
args: --target wasm32-unknown-unknown --features cli-utils,esplora --no-default-features args: --target wasm32-unknown-unknown --features cli-utils,esplora --no-default-features
fmt: fmt:
name: Rustfmt name: Rust fmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - name: checkout
- uses: actions-rs/toolchain@v1 uses: actions/checkout@v2
- name: toolchain
uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: 1.45.0 # MSRV toolchain: stable
override: true override: true
components: rustfmt components: rustfmt
- uses: actions-rs/cargo@v1 - name: fmt check
uses: actions-rs/cargo@v1
with: with:
command: fmt command: fmt
args: --all -- --check args: --all -- --check
# TODO enable this after existing clippy warnings are fixed
# clippy:
# name: Clippy
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: 1.45.0 # MSRV
# override: true
# components: clippy
# - uses: actions-rs/cargo@v1
# with:
# command: clippy
# args: -- -D warnings