diff --git a/commands/update-ui/update-ui.cmd.json b/commands/update-ui/update-ui.cmd.json new file mode 100644 index 0000000..5bf4183 --- /dev/null +++ b/commands/update-ui/update-ui.cmd.json @@ -0,0 +1,23 @@ +{ + "$schema": "../../node_modules/command-bot/src/schema/schema.cmd.json", + "command": { + "description": "Update UI tests, e.g. after a rust toolchain upgrade, and commit them to your PR.", + "configuration": { + "gitlab": { + "job": { + "tags": ["linux-docker-vm-c2"], + "variables": {} + } + } + }, + "presets": { + "substrate": { + "description": "Update substrate UI tests", + "repos": ["substrate"], + "args": { + "rust_version": { "label": "Rust version", "type_rule": "/^[0-9.]+$/", "example": "1.70" } + } + } + } + } +} diff --git a/commands/update-ui/update-ui.sh b/commands/update-ui/update-ui.sh new file mode 100755 index 0000000..74f5aac --- /dev/null +++ b/commands/update-ui/update-ui.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -eu -o pipefail +shopt -s inherit_errexit + +. "$(dirname "${BASH_SOURCE[0]}")/../utils.sh" +. "$(dirname "${BASH_SOURCE[0]}")/../cmd_runner.sh" + +main() { + # setup. + cmd_runner_setup + + rust_version="$1" + if [[ -z "${rust_version}" ]]; then + die "missing rust version argument" + fi + + # This script uses rustup to install the required rust version. + # Doing that in CI feels rather ugly, but sadly there's currently no mechanism + # in command-bot to use a different CI image for individual jobs, so this is + # the best we can do. + .maintain/update-rust-stable.sh "${rust_version}" + + # commit. + git add . + git commit -m "${COMMIT_MESSAGE}" + + # Push the results to the target branch + git remote add \ + github \ + "https://token:${GITHUB_TOKEN}@github.com/${GH_CONTRIBUTOR}/${GH_CONTRIBUTOR_REPO}.git" + git push github "HEAD:${GH_CONTRIBUTOR_BRANCH}" +} + +main "$@"