Skip to content

Commit

Permalink
Ruff linting + tox as test system (#507)
Browse files Browse the repository at this point in the history
* An issue simulating models with the Slab PreProcessor has been fixed (#505)

* adds IDF.copy() and IDF.saveas(inplace=True) (#254)

* Adjusts svg repr to the min/max values of the schedule (#255)

* Graceful warning when Slab or Basement program is not found

* Adds KeyBoardInterupt to IDF Thread

* catches more variations of unit name

* Adds ability to scale a schedule

* Fixes fallback limits for Schedule.plot2d() when Type is not defined

* Type can be specified in Schedule.from_values constructor

* plot2d is prettier by default

* more Typing

* Return existing object when new_object is there (#257)

* Adds ability to replace schedule values without affecting the full load hours

* more robust IDF.name property

* Keep sim files when error occurs (#276)

* updates requests requirement from ~=2.25.1 to >=2.26 (#292)

* typo

* this

* gitsubmodule as https

* p

* pp

* this

* error

* catch outfile

* logging

* Revert "logging"

This reverts commit bef3e4b.

* keep

* as model

* better logging

* comments

---------

Co-authored-by: Samuel Letellier-Duchesne <samueld@mit.edu>
Co-authored-by: Zach Berzolla <53047789+zberzolla@users.noreply.github.com>

* ruff

* actions

* add submodules

* `np.NaN` was removed in the NumPy 2.0 release. Use `np.nan` instead.

* don't show plots

* rm setup.cfg

* add validation options

* tox env var

* fix regex

* fix tests

* tox ini

* fix regex

* data_dir

* fix tests

* exe

* fix files

* pytest xdist

* typo

* no desc

---------

Co-authored-by: Samuel Letellier-Duchesne <samueld@mit.edu>
Co-authored-by: Zach Berzolla <53047789+zberzolla@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 19, 2024
1 parent 88cd43a commit 86569b1
Show file tree
Hide file tree
Showing 116 changed files with 158,982 additions and 9,301 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[run]
omit = tests/*
omit = tests/*
33 changes: 33 additions & 0 deletions .github/actions/setup-poetry-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "setup-poetry-env"
description: "Composite action to setup the Python and poetry environment."

inputs:
python-version:
required: false
description: "The python version to use"
default: "3.11"

runs:
using: "composite"
steps:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction
shell: bash
24 changes: 12 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
# Raise pull requests for version updates
# to pip against the `main` branch
target-branch: "main"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
# Raise pull requests for version updates
# to pip against the `main` branch
target-branch: "main"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
46 changes: 23 additions & 23 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
name-template: "v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: '🚀 New Features'
- title: "🚀 New Features"
labels:
- 'new feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
- "new feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
labels:
- 'refactoring'
- 'dependencies'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
- "refactoring"
- "dependencies"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
- "major"
minor:
labels:
- 'minor'
- 'feature'
- 'new feature'
- 'enhancement'
- "minor"
- "feature"
- "new feature"
- "enhancement"
patch:
labels:
- 'fix'
- 'bugfix'
- 'bug'
- 'patch'
- 'refactoring'
- "fix"
- "bugfix"
- "bug"
- "patch"
- "refactoring"
default: patch
template: |
## Changes
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Main

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
submodules: "true"

- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Set up the environment
uses: ./.github/actions/setup-poetry-env

- name: Run checks
run: make check

tox:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest] # later, add macos-latest, windows-latest
energyplus-version: [9.2.0] # later, add 9.4.0
include:
- runs-on: ubuntu-latest
compiler: gcc
- energyplus-version: 9.2.0
energyplus-sha: 921312fa1d
energyplus-install: 9-2-0
fail-fast: false
steps:
- name: Check out
uses: actions/checkout@v3
with:
submodules: "true"

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Load cached venv
uses: actions/cache@v3
with:
path: .tox
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}

- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Install EnergyPlus
uses: Elementa-Engineering/install-energyplus@v1
with:
energyplus-version: ${{ matrix.energyplus-version }}
energyplus-sha: ${{ matrix.energyplus-sha }}
energyplus-install: ${{ matrix.energyplus-install }}

- name: Test with tox
run: tox -- -n 2 --doctest-modules tests --cov --cov-config=pyproject.toml --cov-report=xml

- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
uses: codecov/codecov-action@v3
if: ${{ matrix.python-version == '3.11' }}
31 changes: 31 additions & 0 deletions .github/workflows/on-release-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: release-main

on:
release:
types: [published]
branches: [main]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
submodules: "true"

- name: Set up the environment
uses: ./.github/actions/setup-poetry-env

- name: Export tag
id: vars
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT

- name: Build and publish
run: |
source .venv/bin/activate
poetry version $RELEASE_VERSION
make build-and-publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
72 changes: 0 additions & 72 deletions .github/workflows/python-package.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/python-publish.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/validate-codecov-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: validate-codecov-config

on:
pull_request:
paths: [codecov.yaml]
push:
branches: [main]

jobs:
validate-codecov-config:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: "true"
- name: Validate codecov configuration
run: curl -sSL --fail-with-body --data-binary @codecov.yaml https://codecov.io/validate
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,4 @@ fabric.properties

docs/reference/

.idea/
.idea/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "geomeppy"]
path = geomeppy
url = git@github.com:samuelduchesne/geomeppy.git
url = https://github.com/samuelduchesne/geomeppy.git
Loading

0 comments on commit 86569b1

Please sign in to comment.