Refactor travis testing

This commit is contained in:
2021-06-07 12:36:22 -06:00
parent 32698b2d5b
commit 610a977b7c
77 changed files with 76 additions and 116 deletions

View File

@@ -4,16 +4,25 @@ os:
- mac
- linux
- windows
haxe:
- stable
- development
env:
# Run basic tests for each combination of target language and operating system
- KISS_TARGET=cpp
- KISS_TARGET=interp
- KISS_TARGET=js
- KISS_TARGET=nodejs
- KISS_TARGET=py
- KISS_TARGET=projects
# Test projects on every operating system
- KISS_PROJECT=aoc
- KISS_PROJECT=asciilib2
- KISS_PROJECT=file-watch
- KISS_PROJECT=kiss-vscode
- KISS_PROJECT=nat-archive-tool
- KISS_PROJECT=pdf-salad
jobs:
# Allow Haxe development to fail.
@@ -25,6 +34,7 @@ jobs:
- script: haxelib install formatter && haxelib run formatter --check -s .
os: linux
haxe: stable
# TODO Check that every project is tested in this file
install:
- if [ "${TRAVIS_OS_NAME}" = "windows" ]; then

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 984 B

After

Width:  |  Height:  |  Size: 984 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -1,3 +0,0 @@
# HaxeFlixel Projects
Various examples of how to combine Kiss with HaxeFlixel

View File

@@ -1,12 +0,0 @@
#! /bin/bash
# Make sure the examples with backends compile, at least:
EXAMPLE_DIRS=./**/
for EXAMPLE_DIR in $EXAMPLE_DIRS
do
echo "Building $EXAMPLE_DIR for html5"
(cd $EXAMPLE_DIR && haxelib run lime build html5)
echo "Building $EXAMPLE_DIR for cpp"
(cd $EXAMPLE_DIR && haxelib run lime build cpp)
done

View File

@@ -1,4 +0,0 @@
#! /bin/bash
haxelib dev nap .
haxe test.hxml

View File

@@ -1,5 +1,5 @@
{
"name": "nap",
"name": "nat-archive-tool",
"url": "https://github.com/hissvn/kisslang",
"license": "LGPL",
"tags": ["cross"],

View File

@@ -1,4 +1,4 @@
package nap;
package nat;
import sys.FileSystem;
import kiss.Prelude;

View File

@@ -1,4 +1,4 @@
package nap;
package nat;
import kiss.KissInterp;
import hscript.Parser;

View File

@@ -1,4 +1,4 @@
package nap;
package nat;
typedef Entry = {
id:String,

View File

@@ -1,4 +1,4 @@
package nap;
package nat;
import kiss.Prelude;
import sys.io.File;

View File

@@ -6,10 +6,10 @@
// TODO add to the documentation a hint that macros should use fully qualified paths so macro caller classes don't need to import everything
(defmacro getComponent [archive e componentType]
`(the nap.components ,componentType
`(the nat.components ,componentType
(tink.Json.parse
(sys.io.File.getContent
(haxe.io.Path.join [.archiveDir (the nap.Archive ,archive) "components" (+ (dictGet (the Map<String,String> .components ,e) ,(symbolName componentType)) ".json")])))))
(haxe.io.Path.join [.archiveDir (the nat.Archive ,archive) "components" (+ (dictGet (the Map<String,String> .components ,e) ,(symbolName componentType)) ".json")])))))
(defun tagList [archive e]
(let [t

View File

@@ -1,4 +1,4 @@
package nap;
package nat;
import kiss.Prelude;

View File

@@ -1,4 +1,4 @@
package nap;
package nat;
interface Template {
function prepareEntry(e:Entry):Void;

View File

@@ -1,3 +1,3 @@
package nap.components;
package nat.components;
typedef Tags = Map<String, Date>;

View File

@@ -1,4 +1,4 @@
package nap.components;
package nat.components;
typedef Name = String;
typedef Author = String;

View File

@@ -1,3 +1,3 @@
package nap.components;
package nat.components;
typedef Tags = Map<String, Int>;

View File

@@ -1,4 +1,4 @@
package nap.systems;
package nat.systems;
import kiss.Prelude;

View File

@@ -2,10 +2,10 @@ package test;
import kiss.Kiss;
import kiss.Prelude;
import nap.BoolExpInterp;
import nap.Archive;
import nap.Lib;
import nap.components.*;
import nat.BoolExpInterp;
import nat.Archive;
import nat.Lib;
import nat.components.*;
@:build(kiss.Kiss.build())
class TestMain {}

View File

@@ -1,7 +1,7 @@
// TODO external programs need to be able to find and (load) this path to get the macros:
// ^ That should be solved by allowing an optional first argument to load that is a symbol
// of a library name that can be used to resolve the source dir in the user's Haxelib maybe?
(load "../nap/Lib.kiss")
(load "../nat/Lib.kiss")
(defun :Void main []

View File

@@ -1,6 +1,6 @@
-D test
-lib kiss
-lib nap
-lib nat-archive-tool
-cp test
--main test.TestMain
--interp

View File

@@ -0,0 +1,4 @@
#! /bin/bash
haxelib dev nat-archive-tool .
haxe test.hxml

View File

@@ -1,5 +1,5 @@
-lib kiss
-lib nap
-lib nat-archive-tool
-cp src
--main Main
--interp

View File

@@ -2,7 +2,7 @@ package;
import kiss.Kiss;
import kiss.Prelude;
import nap.Archive;
import nat.Archive;
@:build(kiss.Kiss.build())
class Main {}

View File

@@ -1,19 +0,0 @@
#! /bin/bash
# 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=kiss/build-scripts/**/test.hxml
for TEST_FILE in $TEST_FILES
do
echo $TEST_FILE
haxe kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml $TEST_FILE
if [ ! $? -eq 0 ]
then
exit 1
fi
done
./test-projects.sh

29
test-project.sh Normal file
View File

@@ -0,0 +1,29 @@
#! /bin/bash
KISS_PROJECT=${KISS_PROJECT:-$1}
KISS_PROJECT=${KISS_PROJECT:-aoc}
haxelib dev kiss kiss
# If project starts with flixel-, test that its code compiles for HTML5 and C++
if [[ $KISS_PROJECT == flixel-* ]]
then
# If running through Travis, install HaxeFlixel with c++ tooling and
if [ ! -z "$TRAVIS_OS_NAME" ]
then
haxelib install lime
haxelib install openfl
haxelib install flixel
haxelib install flixel-addons
haxelib install hxcpp
fi
echo "Building $KISS_PROJECT for html5"
(cd projects/$KISS_PROJECT && haxelib run lime build html5)
echo "Building $KISS_PROJECT for cpp"
(cd projects/$KISS_PROJECT && haxelib run lime build cpp)
# Test other projects with their test.sh file
else
(cd projects/$KISS_PROJECT && haxelib install all --always)
(cd projects/$KISS_PROJECT && ./test.sh)
fi

View File

@@ -1,47 +0,0 @@
#! /bin/bash
# Test the Kiss projects. If run manually, this runs extra manual tests that may involve GUI stuff.
PROJECT_DIRS=projects/**/
if [ ! -z "${TRAVIS_OS_NAME}" ]; then
# Install basic dependencies for Kiss testing
(cd kiss/build-scripts && haxelib install all --always)
# Install HaxeFlixel with c++ tooling because many Kiss projects use it
haxelib install lime
haxelib install openfl
haxelib install flixel
haxelib install flixel-addons
haxelib install hxcpp
fi
for PROJECT_DIR in $PROJECT_DIRS
do
if [ ! -z "${TRAVIS_OS_NAME}" ]; then
haxelib dev kiss kiss
(cd $PROJECT_DIR && haxelib install all --always)
fi
AUTO_TEST_FILE=${PROJECT_DIR}test.sh
if [ -e $AUTO_TEST_FILE ]
then
echo $AUTO_TEST_FILE
(cd $PROJECT_DIR && ./test.sh)
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
(cd $PROJECT_DIR && ./manual-test.sh)
if [ ! $? -eq 0 ]
then
echo "failed"
exit 1
fi
fi
done

20
test.sh
View File

@@ -3,16 +3,18 @@
KISS_TARGET=${KISS_TARGET:-$1}
KISS_TARGET=${KISS_TARGET:-interp}
if [ "$KISS_TARGET" = "projects" ]
# If Travis is running tests, basic dependencies need to be installed
if [ ! -z "$TRAVIS_OS_NAME" ]
then
KISS_HEADLESS="$TRAVIS_OS_NAME" ./test-projects.sh
else
# For CI tests, force install the dependencies
if [ ! -z "$TRAVIS_OS_NAME" ]
then
(cd kiss/build-scripts && haxelib install all --always)
(cd kiss/build-scripts/$KISS_TARGET && haxelib install all --always)
fi
(cd kiss/build-scripts && haxelib install all --always)
(cd kiss/build-scripts/$KISS_TARGET && haxelib install all --always)
fi
# Test projects with test-project.sh
if [ ! -z "$KISS_PROJECT" ]
then
./test-project.sh
# Test Kiss with utest cases in kiss/src/test/cases
else
haxe kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml
fi