Skip to content

feat: upkeep

feat: upkeep #2967

Workflow file for this run

---
name: ci
permissions: write-all
on:
pull_request:
push:
branches:
- master
- dev
- staging
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
concurrency:
group:
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUST_TEST_THREADS: 1
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
RUST_LOG: info
defaults:
run:
shell: bash
jobs:
test-versions:
name: Test Suite on ${{ matrix.rust }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# if you have an MSRV, you can of course include it here too.
rust: [stable, beta, nightly]
steps:
- name: Harden Runner
uses: step-security/harden-runner@5d5d34225d930d298d52ae60999ca9b617dd2e3a
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: ${{ matrix.rust }}
components: rust-src
- uses: taiki-e/install-action@1c96e2750bff5748077b0c814e5bd290059c84a5
with:
tool: cargo-hack
- uses: taiki-e/install-action@1c96e2750bff5748077b0c814e5bd290059c84a5
with:
tool: nextest
- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f
with:
key: ${{ matrix.rust }}
# - run: cargo hack nextest run --no-capture --each-feature --profile ci
- run: cargo nextest run --no-capture --all-features --profile ci
timeout-minutes: 15
msrv:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5d5d34225d930d298d52ae60999ca9b617dd2e3a
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
persist-credentials: false
- uses: taiki-e/install-action@1c96e2750bff5748077b0c814e5bd290059c84a5
with:
tool: cargo-hack
- run:
# cargo hack build -vvv --workspace --feature-powerset --optional-deps
# --ignore-private --no-dev-deps --version-range ..
cargo hack build -vvv --workspace --all-features --ignore-private
--no-dev-deps --version-range ..
tidy:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5d5d34225d930d298d52ae60999ca9b617dd2e3a
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: nightly
components: clippy,rustfmt
- uses: taiki-e/install-action@1c96e2750bff5748077b0c814e5bd290059c84a5
with:
tool: cargo-hack
- uses: taiki-e/install-action@1c96e2750bff5748077b0c814e5bd290059c84a5
with:
tool: cargo-minimal-versions
- run: cargo fmt --all --check
if: always()
- run: cargo clippy --workspace --all-targets
if: always()
- run: cargo minimal-versions build --workspace --ignore-private
if: always()
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5d5d34225d930d298d52ae60999ca9b617dd2e3a
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Checkout repository
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: stable
- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72
with:
command: doc
args: --no-deps --document-private-items --workspace --examples
publish-dry-run:
name: Publish dry run
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5d5d34225d930d298d52ae60999ca9b617dd2e3a
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Checkout repository
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: stable
- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f
- uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72
with:
command: publish
args: --dry-run -p stratum-server
coverage:
name: Code coverage
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5d5d34225d930d298d52ae60999ca9b617dd2e3a
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Checkout repository
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: nightly
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@1c96e2750bff5748077b0c814e5bd290059c84a5
with:
tool: cargo-llvm-cov
- uses: taiki-e/install-action@1c96e2750bff5748077b0c814e5bd290059c84a5
with:
tool: nextest
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2
- name: Generate code coverage
run: |
cargo llvm-cov clean --workspace
cargo llvm-cov nextest --profile ci --no-report --all-features
cargo llvm-cov report --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@6757614f24a05cb3f8641137b1ed46ed44d19fbc
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
bloat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain:
stable
# @todo potentially switch these with Swatinem rust-cache see above.
- name: Cache cargo registry
uses: actions/cache@940f3d7cf195ba83374c77632d1e2cbb2f24ae68 # v3
with:
path: ~/.cargo/registry
key:
bloat-${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock')
}}
- name: Cache cargo index
uses: actions/cache@940f3d7cf195ba83374c77632d1e2cbb2f24ae68 # v3
with:
path: ~/.cargo/git
key:
bloat-${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo bloat
# @todo For security, let's fork this into the OpenPoolProject/actions
# folder - the original (this is a fork) no longer works because it uses
# a 3rd parter server to cache builds that is no longer existant.
uses: Kobzol/cargo-bloat-action@85b93f37dec06662054e045b5cf1d79cfdb0d748
with:
token: ${{ secrets.GITHUB_TOKEN }}
bloat_args: -p stratum-server --release --example basic
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- uses: EmbarkStudios/cargo-deny-action@8af37f5d0c77859223226de776036f7f691e1469 # v1
ci-success:
name: ci
if: success()
needs:
- test-versions
- msrv
- tidy
- docs
- publish-dry-run
- coverage
- bloat
- cargo-deny
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5d5d34225d930d298d52ae60999ca9b617dd2e3a
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Mark the job as a success
run: exit 0