Skip to content

Commit

Permalink
Test update measure xml's
Browse files Browse the repository at this point in the history
  • Loading branch information
jslane-h committed Dec 20, 2024
1 parent b9cd8bb commit 6380b54
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
38 changes: 23 additions & 15 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,34 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build and run unit test Dockerfile
uses: ./.github/actions/unit-test-action

# - name: Build Docker image
# run: |
# docker build -t python_measure_test .
# docker run --rm python_measure_test

- name: Check for FAILURE in pytest_output.txt
run: |
cat test_results/pytest_output.txt
cat test_results/measure_check_output.txt
# cat test_results/pytest_output.txt
# if grep -q 'FAILURE' test_results/pytest_output.txt; then
# exit 1
# fi
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: test_results
path: ${{ github.workspace }}/test_results
path: ${{ github.workspace }}/test_results

- name: Check test results
run: |
cat test_results/pytest_output.txt
if grep -q "FAILURES" test_results/pytest_output.txt; then
exit 1
fi
- name: Update measure.xmls
run: |
cat test_results/measure_check_output.txt
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
git add **/measure.xml
if git diff --cached --quiet; then
echo "No changes to measure.xml files. Skipping commit."
else
git commit -m "Auto-update measure.xml files by GitHub Actions"
git push origin HEAD
fi
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Start with the OpenStudio image
FROM python:3.10

RUN wget https://github.com/NREL/OpenStudio/releases/download/v3.9.0/OpenStudio-3.9.0+c77fbb9569-Ubuntu-22.04-x86_64.tar.gz && \
Expand Down
4 changes: 1 addition & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env bash

echo $GITHUB_WORKSPACE

mkdir $GITHUB_WORKSPACE/test_results

openstudio measure -t ./lib/measures >> $GITHUB_WORKSPACE/test_results/measure_check_output.txt

for dir in $(find . -type f -name 'measure.py' -exec dirname {} \; | sort -u); do
pytest "$dir" >> "$GITHUB_WORKSPACE/test_results/pytest_output.txt"
pytest $dir >> $GITHUB_WORKSPACE/test_results/pytest_output.txt
done

0 comments on commit 6380b54

Please sign in to comment.