-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add workflow for building and testing on GitHub Actions (#40)
Fixes #39
- Loading branch information
1 parent
c1f9580
commit a6e0ca4
Showing
4 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# Builds and tests the package on Linux. | ||
# | ||
# This runs after changes are pushed to a feature branch or to `develop`. | ||
# | ||
|
||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
- '!master' | ||
|
||
jobs: | ||
build: | ||
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Run Tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1702,7 +1702,7 @@ delay a[A3] | |
0 3 | ||
FINAL TIME | ||
0 10 | ||
init | ||
init 1 | ||
0 0 | ||
init 2[A2] | ||
0 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,37 @@ | ||
#!/usr/bin/env sh | ||
# Use the global sde command if it is available. | ||
#!/bin/bash | ||
|
||
set -e # fail on error | ||
|
||
# Use the local sde command. | ||
SDE='node ../sde.js' | ||
if which sde >/dev/null; then SDE=sde; fi | ||
$SDE -v &>/dev/null | ||
if [[ $? -ne 0 ]]; then | ||
echo 'SDEverywhere is not installed.' | ||
echo 'Run "npm install" in the src directory to install it locally.' | ||
echo 'You could also install it globally with "npm install sdeverywhere -g".' | ||
echo 'Run "npm install" in the top directory to install it locally.' | ||
exit 1 | ||
fi | ||
# Test each model against saved Vensim data. | ||
for MODEL in $(ls ../../models); do | ||
echo "testing the $MODEL model" | ||
$SDE clean --modeldir ../../models/$MODEL | ||
CMD="$SDE test ../../models/$MODEL/$MODEL -p 1e-4" | ||
if [[ $MODEL == 'directdata' ]]; then | ||
CMD="$CMD --spec ../../models/$MODEL/spec.json" | ||
|
||
function test { | ||
MODEL=$1 | ||
echo "Testing the $MODEL model" | ||
MODEL_DIR=../../models/$MODEL | ||
$SDE clean --modeldir $MODEL_DIR | ||
if [[ -f $MODEL_DIR/spec.json ]]; then | ||
TEST_ARGS="--spec $MODEL_DIR/spec.json" | ||
else | ||
TEST_ARGS= | ||
fi | ||
$CMD | ||
$SDE clean --modeldir ../../models/$MODEL | ||
done | ||
$SDE test $TEST_ARGS -p 1e-4 $MODEL_DIR/$MODEL | ||
$SDE clean --modeldir $MODEL_DIR | ||
echo | ||
} | ||
|
||
if [[ -n $1 ]]; then | ||
# Test the given model against saved Vensim data. | ||
test $1 | ||
else | ||
# Test each model against saved Vensim data. | ||
for m in $(ls ../../models); do | ||
test $m | ||
done | ||
fi |