diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 847e5b824..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,147 +0,0 @@ -version: 2.1 - -executors: - cargo-executor: - docker: - - image: rust:1 - resource_class: large - cargo-audit-executor: - docker: - - image: rust:1 - resource_class: small - -commands: - install_coverage_dependencies: - steps: - - run: - name: Install grcov and zip - command: | - apt-get update - apt-get install -y zip - cargo install --force grcov - print_version_info: - steps: - - run: - name: Version information - command: | - rustup --version - rustc --version - cargo --version - update_stable_toolchain: - steps: - - run: - name: Update toolchain - command: | - test -z "stable" || echo "stable" >rust-toolchain - rustup show active-toolchain - update_nightly_toolchain: - steps: - - run: - name: Update nightly toolchain - command: | - test -z "nightly" || echo "nightly" >rust-toolchain - rustup show active-toolchain - calculate_cargo_dependencies: - steps: - - run: - name: Calculate dependencies - command: test -e Cargo.lock || cargo generate-lockfile - -jobs: - format: - description: Check proper formatting - executor: cargo-executor - steps: - - checkout - - update_stable_toolchain - - print_version_info - - calculate_cargo_dependencies - - run: - name: Check formatting - command: | - if rustup component add rustfmt; then - cargo fmt --all -- --check - else - echo Skipping rustfmt - fi - clippy: - description: Lint using clippy - executor: cargo-executor - steps: - - checkout - - update_stable_toolchain - - print_version_info - - calculate_cargo_dependencies - - run: - name: Run clippy checks - command: | - if rustup component add clippy; then - cargo clippy --all --all-targets -- -Dwarnings -Drust-2018-idioms - else - echo Skipping clippy - fi - test-stable: - description: Run all tests using the stable toolchain - executor: cargo-executor - steps: - - checkout - - update_stable_toolchain - - print_version_info - - calculate_cargo_dependencies - - run: - name: Build all targets - command: cargo build --all --all-targets - - run: - name: Run all tests - command: cargo test --all - audit: - description: Audit for vulnerable dependencies - executor: cargo-audit-executor - steps: - - checkout - - update_stable_toolchain - - print_version_info - - run: - name: Install Cargo Audit - command: | - cargo install --force cargo-audit - - run: - name: Run Cargo Audit - command: | - cargo audit - test-nightly-coverage: - description: Collect and upload test coverage using the nighly toolchain - executor: cargo-executor - steps: - - checkout - - update_nightly_toolchain - - print_version_info - - install_coverage_dependencies - - calculate_cargo_dependencies - - run: - name: Run tests with coverage env - command: | - export CARGO_INCREMENTAL=0 - export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads" - cargo clean - cargo test --all --verbose - - run: - name: Collect and upload test coverage - command: | - # Note: this currently only matches gc files in crates named *tendermint*. - # This is something to keep in mind if we create crates that do not have tendermint in - # their name. - zip -0 ccov.zip `find . \( -name "*tendermint*.gc*" \) -print` - grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore "/*" -o lcov.info - bash <(curl -s https://codecov.io/bash) -f lcov.info - rm -f lcov.info - rm -f ccov.zip - -workflows: - commit-workflow: - jobs: - - format - - clippy - - test-stable - - test-nightly-coverage - - audit \ No newline at end of file diff --git a/.github/actions-rs/grcov.yml b/.github/actions-rs/grcov.yml new file mode 100644 index 000000000..d70ee56d0 --- /dev/null +++ b/.github/actions-rs/grcov.yml @@ -0,0 +1,6 @@ +branch: true +ignore-not-existing: true +llvm: true +output-type: lcov +output-file: ./lcov.info +prefix-dir: /home/user/build/ diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 000000000..8c208bf2b --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,22 @@ +name: Audit-Check +on: + push: + paths: + - "**/Cargo.toml" + - "**/Cargo.lock" + schedule: + - cron: "0 0 * * *" + +jobs: + security_audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Cache cargo bin + uses: actions/cache@v1 + with: + path: ~/.cargo/bin + key: ${{ runner.os }}-cargo-audit + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..292f15f85 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,81 @@ +name: Rust +on: [pull_request] +jobs: + cleanup-runs: + runs-on: ubuntu-latest + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'" + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + override: true + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features + + test-stable: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: build + args: --all --all-targets + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --no-fail-fast + + test-nightly-coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: clean + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --no-fail-fast + env: + CARGO_INCREMENTAL: "0" + RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads" + - uses: actions-rs/grcov@v0.1 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ${{ steps.coverage.outputs.report }} + yml: ./codecov.yml + fail_ci_if_error: true