Skip to content

Commit

Permalink
devtools: remove and replace x (#2042)
Browse files Browse the repository at this point in the history
  • Loading branch information
geekflyer authored Jul 22, 2022
1 parent beb868b commit 38b1b4c
Show file tree
Hide file tree
Showing 52 changed files with 68 additions and 6,174 deletions.
28 changes: 19 additions & 9 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
[alias]
x = "run --package x --bin x --"
xcheck = "run --package x --bin x -- check"
xclippy = "run --package x --bin x -- clippy"
xfmt = "fmt"
xfix = "run --package x --bin x -- fix"
xtest = "run --package x --bin x -- test"
xlint = "run --package x --bin x -- lint"
xbuild = "run --package x --bin x -- build"
nextest = "run --package x --bin x -- nextest"
xclippy = [
"clippy",
"--workspace",
"--",
"-Dwarnings",
"-Wclippy::all",
"-Aclippy::unit_arg",
"-Aclippy::eval-order-dependence",
"-Aclippy::new-without-default",
"-Aclippy::rc_buffer",
"-Aclippy::upper_case_acronyms",
"-Aclippy::len-without-is-empty",
"-Aclippy::from-iter-instead-of-collect",
"-Aclippy::while-let-on-iterator",
"-Aclippy::bool-assert-comparison",
"-Aclippy::needless-collect",
"-Aclippy::enum-variant-names",
"-Aclippy::self-named-constructors",
]
24 changes: 15 additions & 9 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
HAS_BUILDPULSE_SECRETS: ${{ secrets.BUILDPULSE_ACCESS_KEY_ID != '' && secrets.BUILDPULSE_SECRET_ACCESS_KEY != '' }}
HAS_DATADOG_SECRETS: ${{ secrets.DD_API_KEY != '' }}
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always

# cancel redundant builds
concurrency:
Expand Down Expand Up @@ -120,30 +121,33 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/rust-setup
- run: cargo x lint
- run: cargo xclippy --workspace --all-targets
- uses: pre-commit/[email protected]
- run: cargo xclippy
- run: cargo fmt --check
- run: cargo install cargo-sort
- run: cargo sort --grouped --check --workspace

rust-unit-xtest:
rust-doc-test:
runs-on: high-perf-docker
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it.
- uses: ./.github/actions/rust-setup
- run: cargo xtest --doc --unit --changed-since "origin/main" --exclude aptos-node-checker
- run: cargo test --doc --workspace --exclude aptos-node-checker

rust-unit-nextest:
rust-unit-test:
runs-on: high-perf-docker
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it.
- uses: ./.github/actions/rust-setup
- run: docker run --detach -p 5432:5432 cimg/postgres:14.2
- run: cargo nextest --nextest-profile ci --unit --exclude backup-cli --changed-since "origin/main"
- uses: taiki-e/[email protected]
with:
tool: nextest
- run: cargo nextest run --profile ci --workspace --exclude smoke-test --exclude backup-cli --exclude testcases
env:
INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres

Expand All @@ -167,16 +171,18 @@ jobs:
service: rust-unit-nextest
files: target/nextest/ci/junit.xml

rust-e2e-test:
rust-smoke-test:
runs-on: high-perf-docker
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/rust-setup
- run: docker run --detach -p 5432:5432 cimg/postgres:14.2
- uses: taiki-e/[email protected]
with:
tool: nextest
# --test-threads is intentionally set to reduce resource contention in ci jobs. Increasing this, increases job failures and retries.
- run: cargo nextest --nextest-profile ci --package smoke-test --test-threads 6 --retries 3
- run: cargo nextest run --profile ci --package smoke-test --test-threads 6 --retries 3
env:
RUST_BACKTRACE: full
INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres

- name: Upload test results to BuildPulse for flaky test detection
Expand Down
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
files: \.(rs|move)$
- id: end-of-file-fixer
files: \.(rs|move)$
- id: check-added-large-files
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.3.0
hooks:
- id: insert-license
files: \.rs$
args:
- --license-filepath
- devtools/assets/license_header.txt
- --comment-style
- //
Loading

0 comments on commit 38b1b4c

Please sign in to comment.