Skip to content

Commit

Permalink
Add testing script
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Mar 5, 2020
1 parent 487f1b1 commit 06f86c7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
9 changes: 8 additions & 1 deletion meta/README.md
Expand Up @@ -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.
31 changes: 31 additions & 0 deletions 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
)
)

0 comments on commit 06f86c7

Please sign in to comment.