-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added automated testing, automated deployment of documentation, code …
…styling. (#21) * Updated Python tests. * Updated R tutorial. * Created GitHub workflow file `python_tests_and_linting.yml` for automated testing and linter warnings. * Created GitHub workflow file `update_documentation.yml` for automated deployment of mkdocs documentation to GitHub pages. * Created GitHub workflow file `release.yml` for releasing a `posted` package via PyPI and/or CRAN (to be fully implemented later). --------- Co-authored-by: Philipp C. Verpoort <[email protected]>
- Loading branch information
1 parent
c95f00d
commit 532de0b
Showing
32 changed files
with
1,640 additions
and
574 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: test_automation | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: [3.10.12] # Versions of Python to test against | ||
|
||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry install # Ensure all dependencies are installed | ||
- name: Run tests | ||
if: always() | ||
run: | | ||
poetry run python -m unittest discover | ||
- name: Lint python code with flake8 | ||
if: always() | ||
run: | | ||
poetry run flake8 . | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build-and-deploy-python: | ||
name: Build and Deploy Python Package | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10.12' | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Build package | ||
run: poetry build | ||
|
||
- name: Publish package to PyPI | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: poetry publish --username $TWINE_USERNAME --password $TWINE_PASSWORD | ||
|
||
build-and-deploy-r: | ||
name: Build and Deploy R Package | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up R | ||
uses: r-lib/actions/setup-r@v2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
Rscript -e 'install.packages("devtools")' | ||
- name: Build package | ||
run: | | ||
R CMD build . | ||
- name: Check package | ||
run: | | ||
R CMD check *.tar.gz | ||
- name: Publish package to CRAN | ||
run: | | ||
Rscript -e 'devtools::release()' | ||
env: | ||
CRAN_USERNAME: ${{ secrets.CRAN_USERNAME }} | ||
CRAN_PASSWORD: ${{ secrets.CRAN_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Deploy Documentation | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
types: | ||
- closed | ||
|
||
jobs: | ||
build-and-deploy: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10.12' # Use Python 3.10.12 | ||
|
||
- name: Set up R | ||
uses: r-lib/actions/setup-r@v2 | ||
|
||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev | ||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry install # Ensure all dependencies are installed | ||
- name: Install IRkernel | ||
run: | | ||
pip install jupyter | ||
R -e 'install.packages(c("renv", "IRkernel"))' | ||
R -e 'IRkernel::installspec(user = TRUE)' | ||
- name: Install R dependencies | ||
run: | | ||
R -e "renv::restore()" | ||
- uses: actions/checkout@v2 | ||
- name: Configure Git Credentials | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
|
||
|
||
- uses: actions/cache@v2 | ||
with: | ||
key: mkdocs-material-${{ env.cache_id }} | ||
path: .cache | ||
restore-keys: | | ||
mkdocs-material- | ||
- name: Make file and deploy documentation | ||
run: | | ||
make | ||
git fetch origin gh-pages --depth=1 | ||
poetry run mike set-default develop | ||
poetry run mike deploy develop -p |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ Title: POSTED: Potsdam open-source techno-economic database | |
Version: 0.3.0 | ||
Authors@R: c( | ||
person(given = "Philipp C.", family = "Verpoort", email= "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1319-5006")), | ||
person(given = "Leo", family = "Heidweiler", role = "aut")), | ||
person(given = "Leo", family = "Heidweiler", role = "aut"), | ||
person(given = "Paul", family = "Effing", role = "aut")) | ||
Description: POSTED is a consistent framework, public database, and open-source toolbox of techno-economic data of energy and climate-mitigation technologies. In particular, it provides a structure and contains actual data on capital expenditure, operational expenditure, energy and feedstock demand, emissions intensities, and other characteristics of conversion, storage, and transportation technologies in the energy and related sectors. The accompanying software code is intended for consistent maintenance of this data and for deriving straight-forward results from them, such as levelised cost, levelised emissions intensities, or marginal abatement cost. | ||
License: MIT | ||
|
@@ -22,3 +22,6 @@ Collate: | |
'masking.R' | ||
'tedf.R' | ||
'noslag.R' | ||
Suggests: | ||
testthat (>= 3.0.0) | ||
Config/testthat/edition: 3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(AbstractFieldDefinition) | ||
export(DataSet) | ||
export(Mask) | ||
export(TEBase) | ||
export(TEDF) | ||
export(apply_cond) | ||
export(collect_files) | ||
export(combine_units) | ||
export(is_float) | ||
export(normalise_units) | ||
export(normalise_values) | ||
export(read_csv_file) | ||
export(read_definitions) | ||
export(read_masks) | ||
export(read_yml_file) | ||
export(replace_tags) | ||
export(unit_convert) | ||
export(unit_token_func) |
Oops, something went wrong.