Scaffolding projects with testing

This commit is contained in:
2020-11-17 14:32:01 -07:00
parent e208cee794
commit 0bbe1316b1
8 changed files with 67 additions and 13 deletions

View File

@@ -8,22 +8,26 @@ haxe:
- stable
- development
env:
- HISS_TARGET=cpp
- HISS_TARGET=interp
- HISS_TARGET=js
- HISS_TARGET=nodejs
- HISS_TARGET=py
- KISS_TARGET=cpp
- KISS_TARGET=interp
- KISS_TARGET=js
- KISS_TARGET=nodejs
- KISS_TARGET=py
jobs:
# Allow Haxe development to fail.
allow_failures:
- haxe: development
fast_finish: true
# Check the formatting in a separate job so formatting failures don't hide more important ones
include:
# Check the formatting in a separate job so formatting failures don't hide more important ones
- script: haxelib install formatter && haxelib run formatter --check -s .
os: linux
haxe: stable
# Test experiments in separate job
- script: KISS_HEADLESS=true ./test-projects.sh
haxe: stable
install:
- if [ "${TRAVIS_OS_NAME}" = "windows" ]; then

7
projects/README.md Normal file
View File

@@ -0,0 +1,7 @@
# Kiss Projects
The projects in these folders use kiss in various environments. Some of them might be useful on their own. They are in this repository so they can be tested automatically along with the Kiss compiler.
Each folder's test.sh file will be run automatically by Travis. Project test scripts report failures simply via non-zero exit codes, or if the project throws an exception while running.
Projects can also supply a manual-test.sh file which will run when you run test-all.sh in the repository root. Manual tests can use GUIs, which makes them very useful, but it is harder to guarantee they are run regularly.

View File

@@ -0,0 +1,3 @@
#! /bin/bash
exit 0

View File

@@ -0,0 +1,3 @@
#! /bin/bash
exit 0

View File

@@ -0,0 +1,3 @@
#! /bin/bash
exit 0

View File

@@ -1,7 +1,9 @@
#! /bin/bash
# For local testing. Dependencies won't be installed
# For local testing. Runs manual project tests, which cannot run headless.
# Dependencies won't be installed first
# Test the Kiss compiler on every target language:
TEST_FILES=src/build-scripts/**/test.hxml
for TEST_FILE in $TEST_FILES
@@ -10,6 +12,8 @@ do
haxe src/build-scripts/common-args.hxml src/build-scripts/common-test-args.hxml $TEST_FILE
if [ ! $? -eq 0 ]
then
exit $?
exit 1
fi
done
done
./test-projects.sh

30
test-projects.sh Normal file
View File

@@ -0,0 +1,30 @@
#! /bin/bash
# Test the Kiss projects. If run manually, this runs extra manual tests that may involve GUI stuff.
PROJECT_DIRS=projects/**/
for PROJECT_DIR in $PROJECT_DIRS
do
AUTO_TEST_FILE=${PROJECT_DIR}test.sh
if [ -e $AUTO_TEST_FILE ]
then
echo $AUTO_TEST_FILE
$AUTO_TEST_FILE
if [ ! $? -eq 0 ]
then
echo "failed"
exit 1
fi
fi
MANUAL_TEST_FILE=${PROJECT_DIR}manual-test.sh
if [ -z "$KISS_HEADLESS" ] && [ -e $MANUAL_TEST_FILE ]
then
echo $MANUAL_TEST_FILE
$MANUAL_TEST_FILE
if [ ! $? -eq 0 ]
then
echo "failed"
exit 1
fi
fi
done

View File

@@ -1,13 +1,13 @@
#! /bin/bash
HISS_TARGET=${HISS_TARGET:-$1}
HISS_TARGET=${HISS_TARGET:-interp}
KISS_TARGET=${KISS_TARGET:-$1}
KISS_TARGET=${KISS_TARGET:-interp}
# For CI tests, force install the dependencies
if [ ! -z "$TRAVIS_OS_NAME" ]
then
(cd src/build-scripts && haxelib install all --always)
(cd src/build-scripts/$HISS_TARGET && haxelib install all --always)
(cd src/build-scripts/$KISS_TARGET && haxelib install all --always)
fi
haxe src/build-scripts/common-args.hxml src/build-scripts/common-test-args.hxml src/build-scripts/$HISS_TARGET/test.hxml
haxe src/build-scripts/common-args.hxml src/build-scripts/common-test-args.hxml src/build-scripts/$KISS_TARGET/test.hxml