Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update contributing guide and ui-tests scripts #1668

Merged
merged 12 commits into from
Sep 22, 2023
4 changes: 2 additions & 2 deletions .gitlab/pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 15 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
39 changes: 0 additions & 39 deletions polkadot/scripts/update-rust-stable.sh

This file was deleted.

40 changes: 40 additions & 0 deletions scripts/update-ui-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/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
42 changes: 0 additions & 42 deletions substrate/.maintain/update-rust-stable.sh

This file was deleted.