From 06f86c7e10c6049b3365fc08236d5e58db6f1464 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Thu, 5 Mar 2020 17:18:18 +0100 Subject: [PATCH] Add testing script --- meta/README.md | 9 ++++++++- meta/test_generate.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 meta/test_generate.sh diff --git a/meta/README.md b/meta/README.md index 66a59d3..5b0e730 100644 --- a/meta/README.md +++ b/meta/README.md @@ -3,7 +3,14 @@ This folder is ignored via the `.genignore` file. It contains meta files that should not make it into the generated project. -In particular, it is used for an appveyor CI script that runs on `cosmwasm-template` +In particular, it is used for an AppVeyor CI script that runs on `cosmwasm-template` itself (running the cargo-generate script, then testing the generated project). The `.circleci` directory contains a script destined for any projects created from this template. + +## Files + +- `appveyor.yml`: The AppVeyor CI configuration +- `test_generate.sh`: A script for generating a project from the template and + runnings builds and tests in it. This works almost like the CI script but + targets local UNIX-like dev environments. diff --git a/meta/test_generate.sh b/meta/test_generate.sh new file mode 100755 index 0000000..ea238ad --- /dev/null +++ b/meta/test_generate.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -o errexit -o nounset -o pipefail +command -v shellcheck > /dev/null && shellcheck "$0" + +REPO_ROOT="$(realpath "$(dirname "$0")/..")" + +TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/cosmwasm-template.XXXXXXXXX") + +( + echo "Navigating to $TMP_DIR" + cd "$TMP_DIR" + + GIT_BRANCH=$(git -C "$REPO_ROOT" branch --show-current) + + echo "Generating project from local repository (branch $GIT_BRANCH) ..." + cargo generate --git "$REPO_ROOT" --name test-generation --branch "$GIT_BRANCH" + + ( + cd test-generation + echo "This is what was generated" + ls -lA + + echo "Building wasm ..." + cargo wasm + echo "Running tests ..." + cargo unit-test + cargo integration-test + echo "Creating schema ..." + cargo schema + ) +)