Skip to content

Kestrel

Kestrel #567

Workflow file for this run

name: BuildStockBatch Tests
on:
push:
branches:
- develop
pull_request:
types:
- synchronize
- opened
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
name: Tests - Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
with:
path: buildstockbatch
- uses: actions/checkout@v3
with:
repository: NREL/resstock
path: resstock
ref: develop
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download weather
run: |
mkdir weather
cd weather
wget --quiet https://data.nrel.gov/system/files/156/BuildStock_TMY3_FIPS.zip
- name: Download and Install OpenStudio
run: |
wget -q https://github.com/NREL/OpenStudio/releases/download/v3.7.0-rc1/OpenStudio-3.7.0-rc1+211bb633b0-Ubuntu-22.04-x86_64.deb
sudo apt install -y ./OpenStudio-3.7.0-rc1+211bb633b0-Ubuntu-22.04-x86_64.deb
openstudio openstudio_version
which openstudio
- name: Install buildstockbatch
run: |
cd buildstockbatch
python -m pip install --progress-bar off --upgrade pip
pip install .[dev] --progress-bar off
- name: Linting
run: |
cd buildstockbatch
# stop the build if there are Python syntax errors or undefined names
flake8 buildstockbatch --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 buildstockbatch --count --statistics --exit-zero
- name: Run PyTest and Coverage
run: |
cd buildstockbatch
pytest --junitxml=coverage/junit.xml --cov=buildstockbatch --cov-report=xml:coverage/coverage.xml --cov-report=html:coverage/htmlreport
- name: Test Report
uses: mikepenz/action-junit-report@v3.5.2
if: ${{ matrix.python-version == '3.11' }}
with:
report_paths: buildstockbatch/coverage/junit.xml
check_name: Testing Report
fail_on_failure: true
- name: Save Coverage Report
uses: actions/upload-artifact@v3
if: ${{ matrix.python-version == '3.11' }}
with:
name: coverage-report-html
path: buildstockbatch/coverage/htmlreport/
- name: Save Coverage Report XML
uses: actions/upload-artifact@v3
if: ${{ matrix.python-version == '3.11' }}
with:
name: coverage-report-xml
path: buildstockbatch/coverage/coverage.xml
- name: Build documentation
if: ${{ matrix.python-version == '3.11' }}
run: |
cd buildstockbatch/docs
make html SPHINXOPTS="-W --keep-going -n"
- name: Save Docs
uses: actions/upload-artifact@v3
if: ${{ matrix.python-version == '3.11' }}
with:
name: documentation
path: buildstockbatch/docs/_build/html/
- uses: pre-commit-ci/lite-action@v1.0.1
if: always()