add borehole length to template #2212
Workflow file for this run
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
name: CI | |
on: | |
push: | |
# re-enable all branches until we start simulating again. | |
# branches: | |
# - 'develop' | |
# - 'main' | |
defaults: | |
run: | |
shell: bash | |
# Cancel existing run if a new one is started | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.10", "3.11"] | |
test_env: [python, docs, mypy] | |
mbl_branch: [maint_9.1.x] | |
exclude: | |
# only test mypy on linux for all versions of python | |
- os: windows-latest | |
test_env: mypy | |
# only test docs on linux for all versions of python | |
- os: windows-latest | |
test_env: docs | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display system info | |
run: | | |
python -c "import sys; print(sys.version)" | |
docker --version | |
docker-compose --version | |
- name: Install and configure Poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.5.1 | |
- name: Install dependencies with Poetry | |
run: | | |
poetry --version | |
poetry install | |
poetry update | |
- name: Install modelicafmt | |
run: | | |
RUNNER_SYSTEM=$(python -c 'import platform; print(platform.system())') | |
curl -SLO "https://github.com/urbanopt/modelica-fmt/releases/download/v0.2-pr.2/modelica-fmt_0.2-pr.2_${RUNNER_SYSTEM}_x86_64.tar.gz" | |
tar xzf modelica-fmt_0.2-pr.2_${RUNNER_SYSTEM}_x86_64.tar.gz | |
chmod +x modelicafmt | |
if [[ $RUNNER_SYSTEM == 'Linux' ]]; then | |
sudo mv modelicafmt /usr/local/bin/ | |
else | |
mv modelicafmt '/c/Program Files/' | |
fi | |
- name: Install MBL | |
env: | |
MATRIX_OS: ${{ matrix.os }} | |
MBL_BRANCH: ${{ matrix.mbl_branch }} | |
run: | | |
if [[ "${MATRIX_OS}" == 'ubuntu-latest' ]]; then | |
MODELICAPATH='/home/runner/work/modelica-buildings' | |
else | |
echo $GITHUB_WORKSPACE | |
MODELICAPATH='/c/Program Files/modelica-buildings' | |
fi | |
git clone --single-branch --branch ${MBL_BRANCH} https://github.com/lbl-srg/modelica-buildings.git "${MODELICAPATH}" | |
cd "${MODELICAPATH}" | |
echo "Git branch is $(git branch)" | |
# export MODELICAPATH for subsequent steps | |
echo "MODELICAPATH=${MODELICAPATH}" >> $GITHUB_ENV | |
# Perhaps we want to eneable this again to build the gmt running container? | |
# - | |
# name: Build Spawn Modelica Docker Container | |
# run: | | |
# cd geojson_modelica_translator/modelica/lib/runner | |
# docker build -t nrel/gmt-om-runner:latest . | |
- name: Run pytest (simulation only on linux) | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
run: | | |
if [ '${{ matrix.test_env }}' == 'python' ]; then | |
if [ '${{ matrix.os }}' == 'windows-latest' ]; then | |
poetry run pytest --doctest-modules -v -m 'not simulation and not compilation' ./tests | |
else | |
poetry run pytest --doctest-modules -v --cov-report term-missing --cov . ./tests | |
fi | |
fi | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
with: | |
extra_args: --all-files | |
- name: Run mypy | |
run: | | |
if [ '${{ matrix.test_env }}' == 'mypy' ]; then | |
poetry run mypy --install-types --non-interactive --show-error-codes . | |
fi | |
- name: Build docs | |
run: | | |
if [ '${{ matrix.test_env }}' == 'docs' ]; then | |
cd docs | |
poetry run make html | |
fi | |
- name: Coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.test_env == 'python' && matrix.mbl_branch == 'maint_9.1.x' }} | |
run: | | |
poetry run coveralls | |
- name: Job Failed | |
if: ${{ failure() }} | |
run: | | |
echo "Maybe these logs will help?" | |
ls -alt $GITHUB_WORKSPACE | |
find $GITHUB_WORKSPACE -type f -name 'stdout.log' -print | while read filename; do | |
echo "============================================ stdout.log =========================================" | |
echo "$filename" | |
cat "$filename" | |
done |