Skip to content
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
52 changes: 49 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,27 @@ jobs:
- name: Install dependencies
run: pip install -r requirements.txt

- name: Run tests
run: pytest
continue-on-error: true # TODO: remove once test suite is complete
- name: "Tests: unit, verification, regression, integration (~5 s)"
run: python -m pytest -m "not app" -v --tb=short --durations=10

- name: "Tests: app workflow (~1 min)"
run: python -m pytest -m app -v --tb=short --durations=10

release-check:
name: Version bumped & changelog released
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Check version and CHANGELOG.md against main
run: python -m scripts.check_release --base-ref origin/${{ github.base_ref }}

deploy:
name: Build & deploy to Cloud Run
Expand Down Expand Up @@ -58,3 +76,31 @@ jobs:
--memory=4Gi \
--concurrency=8 \
--max-instances=1

tag-release:
name: Tag & publish GitHub Release
needs: deploy
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Create tag and release if this version is new
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=$(python -c "from utils.version import get_version; print(get_version())")
if git rev-parse -q --verify "refs/tags/v$VERSION" >/dev/null; then
echo "Tag v$VERSION already exists; nothing to release"
exit 0
fi
python -m scripts.check_release --notes > release-notes.md
gh release create "v$VERSION" --target "$GITHUB_SHA" --title "v$VERSION" --notes-file release-notes.md
46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests

# Full suite + changelog check on PRs into development.
# PRs and pushes to main run the same suite in deploy.yml, which gates deployment.
on:
pull_request:
branches: [development]

jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: pip

- name: Install dependencies
run: pip install -r requirements.txt

- name: "Tests: unit, verification, regression, integration (~5 s)"
run: python -m pytest -m "not app" -v --tb=short --durations=10

- name: "Tests: app workflow (~1 min)"
run: python -m pytest -m app -v --tb=short --durations=10

changelog:
name: CHANGELOG.md updated
runs-on: ubuntu-latest
# Add the "skip-changelog" label to a PR for changes that don't need an entry (CI, typos)
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-changelog') }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check that the PR adds a changelog entry
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -qx CHANGELOG.md; then
echo "CHANGELOG.md updated"
else
echo "::error::Add an entry under '## [Unreleased]' in CHANGELOG.md, or label the PR 'skip-changelog'."
exit 1
fi
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ test-measured-data.ipynb

# AI assistant logs
.claude/
CLAUDE.md
CLAUDE.md

# Local hand-calculation spreadsheet (frozen into tests/fixtures/spreadsheet_cases.json)
tests/testing_cases.xlsx
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ repos:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: local
hooks:
- id: pytest-unit
name: pytest (unit tier)
entry: python -m pytest -m unit -x -q --tb=short
language: system
pass_filenames: false
stages: [pre-commit]
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Changelog

All notable changes to the Berkeley Decarb Tool are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project
uses [Semantic Versioning](https://semver.org/). While the version is below 1.0.0:

- **minor** (0.x.0): new features, or changes that alter calculation results or the format of
saved/uploaded data
- **patch** (0.0.x): bug fixes and UI tweaks

Add entries under `[Unreleased]` with every pull request, grouped as Added / Changed / Fixed /
Removed. `scripts/bump_version.py` turns them into a release section.

## [Unreleased]

## [0.1.0] - 2026-10-13

First versioned release of the tool. Earlier deployments were not versioned consistently;
this changelog starts here.

### Added

- Four-step workflow: loads, equipment, emissions, results
- Building load profiles from the library (DOE prototypes and measured data), filterable by
location, building type and vintage, or uploaded as a custom CSV
- Load scaling and base-load adjustment for selected load profiles
- Location search to set the building location independently of the load profile
- Equipment scenarios combining heat recovery water-to-water heat pumps, air-to-water heat pumps,
air-cooled chillers, and gas or electric boilers, with an editable equipment library
- Grid emission scenarios based on NREL Cambium data (long-run and short-run marginal rates),
including refrigerant and natural gas leakage assumptions
- Results page comparing energy use and emissions across equipment and emission scenarios, with
data download
- SI/IP unit toggle
- Tiered automated test suite (unit, verification, regression, integration, app)
- Versioning and changelog workflow; the footer version is read from `pyproject.toml`

### Fixed

- Summary cards on the loads page are shown empty before a load is selected, instead of
"No metadata yet"
- Add/Reset buttons on the equipment and emissions pages stay on the right on narrow windows;
the subtitle wraps instead
- Location set via the location search is stored correctly (#200, #201)
- Faster results download (#110)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ The tool is designed to bring consistency, transparency, and scientific robustne
## Documentation
While the tool is still under development, we have set up a short documentation outlining underlying calculations [here](https://cbe-berkeley.gitbook.io/decarb). <br>

Release notes for each version are in [CHANGELOG.md](CHANGELOG.md). <br>

<!-- - All larger tools should have a dedicated Documentation, ideally set up using GitBook and linked to the `docs` folder. -->

<p align="right">(<a href="#readme-top">back to top</a>)</p>
Expand Down
Loading
Loading