Skip to content

Commit

Permalink
Final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterpeere committed Jan 26, 2024
1 parent 42dd37c commit 26684ec
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 122 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CD to pypi

on:
push:
branches:
- master

permissions:
contents: write

jobs:
build:
if: "contains(github.event.head_commit.message, 'auto-update version')"
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-testpypi:
needs: build
if: "contains(github.event.head_commit.message, 'rc') || contains(github.event.head_commit.message, 'dev')"
name: Publish 📦 to TestPyPI
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/ghetool

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TESTPYPI }}

publish-to-pypi:
needs: build
if: "!contains(github.event.head_commit.message, 'rc') && !contains(github.event.head_commit.message, 'dev')"
name: Publish 📦 to PyPI
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/ghetool

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://pypi.org/legacy/
user: __token__
password: ${{ secrets.PYPI }}
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docs
name: Create docs
on: [push, release]

jobs:
Expand Down
156 changes: 43 additions & 113 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,107 +1,22 @@
name: Release
name: A new release

on:
- push

jobs:

test_methods:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
pip install -e .
- name: Test with pytest
run: pytest GHEtool/test/methods/test_methods.py --cov=./ --cov-report=xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos

test_general:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
pip install -e .
- name: Test with pytest
run: pytest GHEtool/test/general_tests --cov=./ --cov-report=xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos

test_examples:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
pip install -e .
- name: Test with pytest
run: pytest GHEtool/test/test_examples.py --cov=./ --cov-report=xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
release:
types: [ published ]

test_validation:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
pip install -e .
- name: Test with pytest
run: pytest GHEtool/test/test_validation.py --cov=./ --cov-report=xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
permissions:
contents: write

jobs:
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

name: release tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -110,25 +25,40 @@ jobs:
pip install -e .
- name: Test with pytest
run: pytest GHEtool/test/unit-tests --cov=./ --cov-report=xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos

release:
needs: [test_methods, test_general, test_examples, test_validation, unit-tests]
runs-on: windows-latest
create-tag:
name: Set tag
needs: unit-tests
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ""
STRIPPED_VERSION: ""
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
- name: Checkout code
uses: actions/checkout@v2
with:
python-version: '3.12'
- name: Install dependencies
token: ${{ secrets.TOKEN }}
persist-credentials: false

- name: Set output
id: vars
run: echo "RELEASE_VERSION=${{ github.event.release.name }}" >> $GITHUB_ENV

- name: Check output
id: split
run: echo "STRIPPED_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV

- name: Set up Git
run: git config --global user.email "${{ secrets.EMAIL }}" && git config --global user.name "GitHub Actions"

- name: Update version in version file and commit
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
pip install -e .
- name: Test with pytest
run: pytest GHEtool/test/test_validation.py --cov=./ --cov-report=xml
echo "${STRIPPED_VERSION}" > VERSION.txt
cat VERSION.txt
git add VERSION.txt
git commit -am "Release: auto-update version to ${RELEASE_VERSION}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: '3.12'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: '3.12'
Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: '3.12'
Expand All @@ -51,7 +51,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: '3.12'
Expand All @@ -72,7 +72,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: '3.12'
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. For future

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [2.2.1] - 2024-01-18
## [2.2.1] - 2024-01-26

## Added
- GHEtool is available on conda-forge (issue #107).
Expand All @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## changed
- Negative reference temperatures for the fluid are now possible (issue #192).
- Move code related to the GUI to a separate repo (issue #210).
- Autorelease to PyPi and testPyPi (issue #212).

## fixed
- Problem with multiyear hourly data and L3 sizing (issue #153).
Expand All @@ -24,7 +25,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Bug in saving after a file has been moved (issue #198).
- Bug in DHW and peak heating power(issue #202).


## [2.2.0] - 2023-10-17

## Added
Expand Down
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.1
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = GHEtool
version = 2.2.1
version = file: VERSION.txt
author = Wouter Peere
author_email = [email protected]
description = Python package for borefield sizing
Expand Down

0 comments on commit 26684ec

Please sign in to comment.