diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 3cb1e7ede9e..57181650183 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -47,38 +47,50 @@ jobs: - name: format check run: | cd ${{github.workspace}} - make gen_proxy_ffi - GIT_STATUS=$(git status -s) && if [[ ${GIT_STATUS} ]]; then echo "Error: found illegal git status"; echo ${GIT_STATUS}; [[ -z ${GIT_STATUS} ]]; fi - cargo fmt -- --check >/dev/null + make ci_fmt_check - name: test run: | - # export RUSTC_WRAPPER=~/.cargo/bin/sccache - # make test - # make debug - export ENGINE_LABEL_VALUE=tiflash - export RUST_BACKTRACE=full - cargo check - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_normal - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_bootstrap - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_compact_log - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_early_apply - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_encryption - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_pd_client - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_pending_peers - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_transaction - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_cmd_epoch_checker - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_disk_full - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_snap - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_merge - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_import_service - cargo test --features compat_old_proxy --package tests --test failpoints cases::test_proxy_replica_read - # tests based on new-mock-engine-store, with compat for new proxy - cargo test --package tests --test proxy normal::store - cargo test --package tests --test proxy normal::region - cargo test --package tests --test proxy normal::config - cargo test --package tests --test proxy normal::write - cargo test --package tests --test proxy normal::ingest - cargo test --package tests --test proxy normal::snapshot - cargo test --package tests --test proxy normal::restart - # tests based on new-mock-engine-store, for some tests not available for new proxy - cargo test --package tests --test proxy proxy + M="testold" ./ci_check.sh + + build-check-new: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: cache cargo env + id: cache-cargo + uses: actions/cache@v2 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/rust-toolchain') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: install rust + if: steps.cache-cargo.outputs.cache-hit != 'true' + run: | + curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path --default-toolchain none -y + export PATH=~/.cargo/bin/:$PATH + rustup self update && rustup set profile minimal && rustup default $(cat "rust-toolchain") + # cargo install sccache + # - name: cache build target + # uses: actions/cache@v2 + # env: + # cache-name: cargo-target + # with: + # path: | + # target/ + # # ~/.cache/sccache/ + # key: ${{ runner.os }}-${{ env.cache-name }}-v1-${{ hashFiles('**/rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }} + # restore-keys: | + # ${{ runner.os }}-${{ env.cache-name }}-v1-${{ hashFiles('**/rust-toolchain') }}- + - name: format check + run: | + cd ${{github.workspace}} + make ci_fmt_check + - name: test + run: | + M="testnew" ./ci_check.sh diff --git a/Makefile b/Makefile index aae95d63b37..440780e95dc 100644 --- a/Makefile +++ b/Makefile @@ -299,6 +299,13 @@ pre-format: unset-override @rustup component add rustfmt @cargo install --force -q cargo-sort +ci_fmt_check: + M="fmt" ./ci_check.sh + +ci_test: + M="testold" ./ci_check.sh + M="testnew" ./ci_check.sh + gen_proxy_ffi: pre-format ./gen-proxy-ffi.sh diff --git a/ci_check.sh b/ci_check.sh new file mode 100755 index 00000000000..472aca12ce5 --- /dev/null +++ b/ci_check.sh @@ -0,0 +1,37 @@ +if [[ $M == "fmt" ]]; then + make gen_proxy_ffi + GIT_STATUS=$(git status -s) && if [[ ${GIT_STATUS} ]]; then echo "Error: found illegal git status"; echo ${GIT_STATUS}; [[ -z ${GIT_STATUS} ]]; fi + cargo fmt -- --check >/dev/null +elif [[ $M == "testold" ]]; then + export ENGINE_LABEL_VALUE=tiflash + export RUST_BACKTRACE=full + cargo check + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_normal + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_bootstrap + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_compact_log + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_early_apply + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_encryption + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_pd_client + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_pending_peers + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_transaction + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_cmd_epoch_checker + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_disk_full + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_snap + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_merge + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_import_service + cargo test --features compat_old_proxy --package tests --test failpoints cases::test_proxy_replica_read +elif [[ $M == "testnew" ]]; then + # tests based on new-mock-engine-store, with compat for new proxy + cargo test --package tests --test proxy normal::store + cargo test --package tests --test proxy normal::region + cargo test --package tests --test proxy normal::config + cargo test --package tests --test proxy normal::write + cargo test --package tests --test proxy normal::ingest + cargo test --package tests --test proxy normal::snapshot + cargo test --package tests --test proxy normal::restart + # tests based on new-mock-engine-store, for some tests not available for new proxy + cargo test --package tests --test proxy proxy +elif [[ $M == "debug" ]]; then + # export RUSTC_WRAPPER=~/.cargo/bin/sccache + make debug +fi