From 81f8c379d03fec18165d309d8a43d5c3cafa692d Mon Sep 17 00:00:00 2001 From: Mike the Tike Date: Wed, 17 Nov 2021 14:13:06 +0200 Subject: [PATCH] ci: split cucumber job into two (#3583) Split circle ci job into two smaller jobs --- .circleci/config.yml | 232 ++++-------------- .../features/WalletTransactions.feature | 2 +- 2 files changed, 44 insertions(+), 190 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f502eb02da..bb6fa80f20 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,97 +4,52 @@ defaults: rust_image: &rust_image quay.io/tarilabs/rust_tari-build-with-deps:nightly-2021-09-18 commands: - test: - description: Run the tests - parameters: - release: - description: Set this to true to compile in release mode. - type: boolean - default: false + cucumber-js: + description: Run cucumber scenarios steps: - run: - name: Calculate dependencies - command: | - rustc --version >rust-version - test -e Cargo.lock || cargo generate-lockfile + name: node -v + command: node -v - run: - name: Install cargo2junit - command: cargo install cargo2junit - - restore_cache: - keys: - - v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-<>-{{checksum "Cargo.lock"}} + name: npm ci + command: cd integration_tests && npm ci - run: - name: Run tests - command: mkdir -p testresults && cargo test --workspace --all-features -v --jobs=3 <<#parameters.release>>--release<> -- -Z unstable-options --format json --report-time | cargo2junit > testresults/results.xml - - save_cache: - paths: - - /usr/local/cargo/registry - - target - key: v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-<>-{{checksum "Cargo.lock"}} - - store_test_results: - path: testresults - - store_artifacts: - path: testresults - build: - description: Build - parameters: - release: - description: Set this to true to compile in release mode. - type: boolean - default: false - steps: + name: Check formatting + command: cd integration_tests && npm run check-fmt - run: - name: Calculate dependencies - command: | - rustc --version >rust-version - test -e Cargo.lock || cargo generate-lockfile - - restore_cache: - keys: - - v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-<>-{{checksum "Cargo.lock"}} + name: Check eslint + command: cd integration_tests && npm run lint - run: - name: Build - command: cargo build -v --all --all-features --jobs=3 <<#parameters.release>>--release<> + name: Build base node + command: cargo build --release --bin tari_base_node - run: - name: Build Wallet - command: cargo build -p tari_wallet <<#parameters.release>>--release<> - - save_cache: - paths: - - /usr/local/cargo/registry - - target - key: v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-<>-{{checksum "Cargo.lock"}} - clippy: - description: cargo clippy - steps: + name: Build wallet + command: cargo build --release --bin tari_console_wallet - run: - name: Calculate dependencies - command: | - rustc --version >rust-version - test -e Cargo.lock || cargo generate-lockfile - - restore_cache: - keys: - - v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-{{checksum "Cargo.lock"}} + name: Build mmproxy + command: cargo build --release --bin tari_merge_mining_proxy - run: - name: Cargo fmt - command: | - TOOLCHAIN=$(awk '/channel = /{print $NF}' rust-toolchain.toml) - rustup component add --toolchain $TOOLCHAIN rustfmt - cargo fmt --all -- --check + name: Build mining_node + command: cargo build --release --bin tari_mining_node - run: - name: Run clippy (main source) - command: | - TOOLCHAIN=$(awk '/channel = /{print $NF}' rust-toolchain.toml) - rustup component add --toolchain $TOOLCHAIN clippy - cargo clippy -- -D warnings -W clippy::cognitive_complexity + name: Build stratum_transcoder + command: cargo build --release --bin tari_stratum_transcoder - run: - name: Run clippy (all targets) - command: cargo clippy --all-targets -- -D warnings - - save_cache: - paths: - - /usr/local/cargo/registry - - target - key: v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-{{checksum "Cargo.lock"}} - cucumber-js: - description: Run cucumber scenarios + name: Run cucumber scenarios + no_output_timeout: 20m + command: cd integration_tests && mkdir -p cucumber_output && node_modules/.bin/cucumber-js --profile "ci" --tags "@critical and not @long-running and not @broken and not @wallet-ffi" --format json:cucumber_output/tests.cucumber --exit --retry 3 --retry-tag-filter "@flaky and not @broken" + - run: + name: Generate report + command: cd integration_tests && node ./generate_report.js + when: always + - store_test_results: + path: integration_tests/cucumber_output + - store_artifacts: + path: integration_tests/cucumber_output + - store_artifacts: + path: integration_tests/temp/reports + cucumber-js-ffi: + description: Run cucumber scenarios (FFI) steps: - run: name: node -v @@ -102,9 +57,6 @@ commands: - run: name: npm ci command: cd integration_tests && npm ci - - run: - name: Check formatting - command: cd integration_tests && npm run check-fmt - run: name: Check eslint command: cd integration_tests && npm run lint @@ -126,14 +78,6 @@ commands: - run: name: Build stratum_transcoder command: cargo build --release --bin tari_stratum_transcoder - - run: - name: Run cucumber scenarios - no_output_timeout: 20m - command: cd integration_tests && mkdir -p cucumber_output && node_modules/.bin/cucumber-js --profile "ci" --tags "@critical and not @long-running and not @broken and not @wallet-ffi" --format json:cucumber_output/tests.cucumber --exit --retry 3 --retry-tag-filter "@flaky and not @broken" - - run: - name: Generate report - command: cd integration_tests && node ./generate_report.js - when: always # Below step requires NodeJS v12 to run correctly, see explanation in WalletFFI.feature - run: name: Run FFI wallet library cucumber scenarios @@ -154,30 +98,6 @@ commands: path: integration_tests/temp/reports jobs: - test-docs: - docker: - - image: *rust_image - steps: - - checkout - - run: - name: RFC documentation - command: | - cargo install mdbook --version ^0.4 - cd RFC && mdbook test && mdbook build - - - persist_to_workspace: - root: . - paths: book - - test-tari-release: - docker: - - image: *rust_image - resource_class: medium - steps: - - checkout - - test: - release: true - run-integration-tests: docker: - image: *rust_image @@ -188,64 +108,16 @@ jobs: - checkout - cucumber-js - build-tari-release: - docker: - - image: *rust_image - resource_class: medium - steps: - - checkout - - build: - release: true - - clippy: + run-ffi-integration-tests: docker: - image: *rust_image resource_class: medium + environment: + CARGO_HTTP_MULTIPLEXING: false steps: - checkout - - clippy + - cucumber-js-ffi - deploy-docs: - docker: - - image: quay.io/tarilabs/git-ssh-client:0.2-alpine - steps: - - checkout - - attach_workspace: - at: . - - add_ssh_keys: - fingerprints: - - "a6:a6:e2:be:a3:94:3e:4c:9d:51:25:f6:98:f9:0c:a4" - - run: - name: Deploy docs to gh-pages branch - command: | - DEST_BRANCH=gh-pages - DEST_PATH=book/ - - if [[ ! -d $DEST_PATH ]]; then - echo "$DEST_PATH directory not found!" - exit 1 - fi - - TMP_DIR=$(mktemp -d /tmp/ghpages_XXXXXX) - - echo "Copying book files to temporary location $TMP_DIR" - cp -R $DEST_PATH/* $DEST_PATH/.nojekyll $TMP_DIR - - REMOTE=$(git remote get-url origin) - - cd $TMP_DIR - - git config --global user.email "ci-build@tari.com" - git config --global user.name "ci-build" - - git init - git checkout -b $DEST_BRANCH - git remote add origin $REMOTE - git add --all . - git commit -m "[skip ci] Update RFC docs" - git push origin $DEST_BRANCH --force - - echo "Published." workflows: version: 2 @@ -255,25 +127,7 @@ workflows: filters: branches: ignore: gh-pages - # - test-docs: - # filters: - # branches: - # ignore: gh-pages - # - deploy-docs: - # requires: - # - test-docs - # filters: - # branches: - # only: development - # - build-tari-release: - # filters: - # branches: - # ignore: gh-pages - # - test-tari-release: - # filters: - # branches: - # ignore: gh-pages - # - clippy: - # filters: - # branches: - # ignore: gh-pages + - run-ffi-integration-tests: + filters: + branches: + ignore: gh-pages \ No newline at end of file diff --git a/integration_tests/features/WalletTransactions.feature b/integration_tests/features/WalletTransactions.feature index 96d7378903..a279582e1b 100644 --- a/integration_tests/features/WalletTransactions.feature +++ b/integration_tests/features/WalletTransactions.feature @@ -1,7 +1,7 @@ @wallet-transact @wallet Feature: Wallet Transactions - @critical + @critical @flaky Scenario: Wallet sending and receiving one-sided transactions Given I have a seed node NODE And I have 1 base nodes connected to all seed nodes