Skip to content
Snippets Groups Projects
Unverified Commit 3d9f5e8b authored by Maksym H's avatar Maksym H Committed by GitHub
Browse files

update contributing guide and ui-tests scripts (#1668)


- Updated ./docs/CONTRIBUTION.md to clarify how to use command bot and
update ui-tests locally or in PR
- Moved update-ui-tests.sh to a root of project to run them along for
substrate and polkadot together

---------

Co-authored-by: default avatarMira Ressel <mira@parity.io>
parent f79fa6c8
No related merge requests found
Pipeline #393426 passed with stages
in 52 minutes and 20 seconds
......@@ -314,8 +314,8 @@ node-bench-regression-guard:
--compare-with artifacts/benches/$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
after_script: [""]
# if this fails (especially after rust version upgrade) run
# ./substrate/.maintain/update-rust-stable.sh <rust_version>
# if this fails run `bot update-ui` in the Pull Request or "./scripts/update-ui-tests.sh" locally
# see ./docs/CONTRIBUTING.md#ui-tests
test-frame-ui:
stage: test
extends:
......
......@@ -143,4 +143,18 @@ UI tests are used for macros to ensure that the output of a macro doesn’t chan
These UI tests are sensible to any changes in the macro generated code or to switching the rust stable version.
The tests are only run when the `RUN_UI_TESTS` environment variable is set. So, when the CI is for example complaining
about failing UI tests and it is expected that they fail these tests need to be executed locally.
To simplify the updating of the UI test output there is the `.maintain/update-rust-stable
To simplify the updating of the UI test output there is a script
- `./scripts/update-ui-tests.sh` to update the tests for a current rust version locally
- `./scripts/update-ui-tests.sh 1.70` # to update the tests for a specific rust version locally
Or if you have opened PR and you're member of `paritytech` - you can use command-bot to run the tests for you in CI:
- `bot update-ui` - will run the tests for the current rust version
- `bot update-ui latest --rust_version=1.70.0` - will run the tests for the specified rust version
- `bot update-ui latest -v CMD_IMAGE=paritytech/ci-unified:bullseye-1.70.0-2023-05-23 --rust_version=1.70.0` -
will run the tests for the specified rust version and specified image
## Command Bot
If you're member of **paritytech** org - you can use command-bot to run various of common commands in CI:
Start with comment in PR: `bot help` to see the list of available commands.
#!/usr/bin/env bash
#
# Script for updating the UI tests for a new rust stable version.
#
# It needs to be called like this:
#
# update-rust-stable.sh 1.61
#
# This will run all UI tests with the rust stable 1.61. The script
# requires that rustup is installed.
set -e
if [ "$#" -ne 1 ]; then
echo "Please specify the rust version to use. E.g. update-rust-stable.sh 1.61"
exit
fi
RUST_VERSION=$1
if ! command -v rustup &> /dev/null
then
echo "rustup needs to be installed"
exit
fi
rustup install $RUST_VERSION
rustup component add rust-src --toolchain $RUST_VERSION
# Ensure we run the ui tests
export RUN_UI_TESTS=1
# We don't need any wasm files for ui tests
export SKIP_WASM_BUILD=1
# Let trybuild overwrite the .stderr files
export TRYBUILD=overwrite
# Run all the relevant UI tests
#
# Any new UI tests in different crates need to be added here as well.
rustup run $RUST_VERSION cargo test -p orchestra ui
#!/usr/bin/env bash
# Script for updating the UI tests for a new rust stable version.
# Exit on error
set -e
# by default current rust stable will be used
RUSTUP_RUN=""
# check if we have a parameter
# ./scripts/update-ui-tests.sh 1.70
if [ ! -z "$1" ]; then
echo "RUST_VERSION: $1"
# This will run all UI tests with the rust stable 1.70.
# The script requires that rustup is installed.
RUST_VERSION=$1
RUSTUP_RUN="rustup run $RUST_VERSION"
echo "installing rustup $RUST_VERSION"
if ! command -v rustup &> /dev/null
then
echo "rustup needs to be installed"
exit
fi
rustup install $RUST_VERSION
rustup component add rust-src --toolchain $RUST_VERSION
fi
# Ensure we run the ui tests
export RUN_UI_TESTS=1
# We don't need any wasm files for ui tests
export SKIP_WASM_BUILD=1
# Let trybuild overwrite the .stderr files
export TRYBUILD=overwrite
# ./substrate
$RUSTUP_RUN cargo test -p sp-runtime-interface ui
$RUSTUP_RUN cargo test -p sp-api-test ui
$RUSTUP_RUN cargo test -p frame-election-provider-solution-type ui
$RUSTUP_RUN cargo test -p frame-support-test ui
#!/usr/bin/env bash
#
# Script for updating the UI tests for a new rust stable version.
#
# It needs to be called like this:
#
# update-rust-stable.sh 1.61
#
# This will run all UI tests with the rust stable 1.61. The script
# requires that rustup is installed.
set -e
if [ "$#" -ne 1 ]; then
echo "Please specify the rust version to use. E.g. update-rust-stable.sh 1.61"
exit
fi
RUST_VERSION=$1
if ! command -v rustup &> /dev/null
then
echo "rustup needs to be installed"
exit
fi
rustup install $RUST_VERSION
rustup component add rust-src --toolchain $RUST_VERSION
# Ensure we run the ui tests
export RUN_UI_TESTS=1
# We don't need any wasm files for ui tests
export SKIP_WASM_BUILD=1
# Let trybuild overwrite the .stderr files
export TRYBUILD=overwrite
# Run all the relevant UI tests
#
# Any new UI tests in different crates need to be added here as well.
rustup run $RUST_VERSION cargo test -p sp-runtime-interface ui
rustup run $RUST_VERSION cargo test -p sp-api-test ui
rustup run $RUST_VERSION cargo test -p frame-election-provider-solution-type ui
rustup run $RUST_VERSION cargo test -p frame-support-test ui
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment