Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autotests #16

Merged
merged 6 commits into from
Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: develop

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:

runs-on: ubuntu-latest
container: slacgismo/gridlabd:develop

steps:
- uses: actions/checkout@v2
- name: Validate build
run: make validate
18 changes: 18 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: master

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
container: slacgismo/gridlabd:latest

steps:
- uses: actions/checkout@v2
- name: Validate build
run: make validate
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store
__MACOSX/
__pycache__/
*.pyc
test/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "autotest/models"]
path = autotest/models
url = https://github.com/slacgismo/gridlabd-models.git
4 changes: 2 additions & 2 deletions .orgs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# list the folders that should be published
US
# list the folders that should be tested
US/CA/SLAC
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ SOURCE=$(subst $(INSTALL)/share/gridlabd/template,.,$(TARGET))
TEMPLATES=ica_analysis
FILES=$(foreach template,$(TEMPLATES),$(wildcard $(SOURCE)/$(template)/*))

help:

build:
./compile

Expand All @@ -20,3 +22,14 @@ install: $(subst ./,$(INSTALL)/share/gridlabd/template/,$(FILES))

$(TARGET)/%: $(SOURCE)/%
@mkdir -p $(dir $@) && cp -R $< $@

#!/bin/bash

TEMPLATES=$(foreach ORG,$(shell grep -v ^\# .orgs),$(shell find $(ORG) -type d -print -prune))
TESTDIR=autotest/models/gridlabd-4
TESTFILES=$(foreach GLM,$(shell find $(TESTDIR) -name '*.glm' -print),$(TESTDIR)/$(GLM))

validate: $(TESTFILES)

$(TESTDIR)/%.glm: %.glm
$(foreach TEMPLATE,$(TEMPLATES),. validate.sh "$<" "$(TEMPLATE)")
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![master](https://github.com/slacgismo/gridlabd-template/actions/workflows/master.yml/badge.svg)](https://github.com/slacgismo/gridlabd-template/actions/workflows/master.yml)
[![develop](https://github.com/slacgismo/gridlabd-template/actions/workflows/develop.yml/badge.svg)](https://github.com/slacgismo/gridlabd-template/actions/workflows/develop.yml)

To view the online documentation please use the [Docs Browser](https://docs.gridlabd.us/) and select the `gridlabd-template` project.
# GridLAB-D Analysis Templates

Expand Down
1 change: 1 addition & 0 deletions autotest/models
Submodule models added at 731243
20 changes: 0 additions & 20 deletions compile

This file was deleted.

1 change: 0 additions & 1 deletion docs/Integrate capacity analysis.md

This file was deleted.

File renamed without changes.
15 changes: 15 additions & 0 deletions validate
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -x
set -e

for TEMPLATE in $(cat $2/.index); do
GLMNAME=$(basename "$1")
DIRNAME=${GLMNAME/.glm/}
TESTDIR=test/$(dirname "$1")/$DIRNAME/$2/$TEMPLATE
echo "Testing $TESTDIR/$GLMNAME..."
mkdir -p "$TESTDIR"
cp "$1" "$TESTDIR"
cd "$TESTDIR"
gridlabd template get "$TEMPLATE" 1>stdout 2>stderr
gridlabd "$GLMNAME" -t "$TEMPLATE" --redirect all 1>>stdout 2>>stderr
done
15 changes: 15 additions & 0 deletions validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -x
set -e

for TEMPLATE in $(cat $2/.index); do
GLMNAME=$(basename "$1")
DIRNAME=${GLMNAME/.glm/}
TESTDIR=test/$(dirname "$1")/$DIRNAME/$2/$TEMPLATE
echo "Testing $TESTDIR/$GLMNAME..."
mkdir -p "$TESTDIR"
cp "$1" "$TESTDIR"
cd "$TESTDIR"
gridlabd template get "$TEMPLATE" 1>stdout 2>stderr
gridlabd "$GLMNAME" -t "$TEMPLATE" --redirect all 1>>stdout 2>>stderr
done