Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: bvandekerkhof <bas.vandekerkhof@shell.com>
  • Loading branch information
bvandekerkhof committed Feb 8, 2024
0 parents commit 0966643
Show file tree
Hide file tree
Showing 55 changed files with 9,949 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/bump_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

import re

with open("pyproject.toml", "r") as file:
version_content = file.read()
# Match regex for <version="0.0.0a",> pattern
old_semantic_version = re.findall(r'version = "(\d+\.\d+\.[a-zA-Z0-9]+)"', version_content)
major_version, minor_version, patch_version = old_semantic_version[0].split(".")
patch_version = int(re.findall(r"\d+", patch_version)[0])
new_semantic_version = f"{major_version}.{minor_version}.{patch_version + 1}"
regex_bumped_patch_version = f"\g<1>{new_semantic_version}"
# Match regex for <version = "0.0.0a"> pattern
bumped_version_content = re.sub(r'(version = ")\d+\.\d+\.[a-zA-Z0-9]+', regex_bumped_patch_version, version_content)
with open("pyproject.toml", "w") as file:
file.write(bumped_version_content)
print(new_semantic_version) # Print is required for release in GitHub action
46 changes: 46 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!--
SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->

# Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# Jupyter Notebooks

If your changes involve Jupyter notebooks please explicitly state here what the change consists of, e.g. only output
cells have changes or specific input changes. This to make sure we capture these changes correctly in the review process.

# How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

- [ ] Test A
- [ ] Test B


# Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

34 changes: 34 additions & 0 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: Building the package
on:
push:
branches:
- 'main'
jobs:
Build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.11" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build
- name: Build the package
run: |
python -m build
- name: Upload build files
uses: actions/upload-artifact@v3
with:
name: openmcmc_whl
path: ./dist/*.whl
42 changes: 42 additions & 0 deletions .github/workflows/code_formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: Code formatting
on:
- push
jobs:
Black:
runs-on: ubuntu-latest
strategy:
matrix:
# Specify all python versions you might want to perform the actions on
python-version: [ "3.11" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black
pip install isort
- name: Run isort, black checks
run: |
isort . --check
black . --check
- name: Run isort and black when required and commit back
if: failure()
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.OPENMCMC_TOKEN }}
run: |
isort .
black .
git config --global user.name 'code_reformat'
git config --global user.email ''
git remote set-url origin "https://$GITHUB_ACCESS_TOKEN@github.com/$GITHUB_REPOSITORY"
git commit --signoff -am "Automatic reformat of code"
git push
26 changes: 26 additions & 0 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: publish documentation
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- run: pip install mkdocs-material
- run: pip install mkdocstrings-python
- run: mkdocs gh-deploy --force
28 changes: 28 additions & 0 deletions .github/workflows/pydocstyle_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: pydocstyle
on:
- push
jobs:
pydocstyle:
runs-on: ubuntu-latest
strategy:
matrix:
# Specify all python versions you might want to perform the actions on
python-version: [ "3.11" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pydocstyle
- name: Run PydocStyle check
run: |
pydocstyle .
38 changes: 38 additions & 0 deletions .github/workflows/pylint_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

on:
- push

name: Pylint Check
jobs:
Pylint:
# Specify the operating system GitHub has to use to perform the checks (ubuntu seems to be default)
runs-on: ubuntu-latest
strategy:
matrix:
# Specify all python versions you might want to perform the actions on
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install .
- name: Analysing the code with pylint
if: ${{ always() }}
# Run through the src/openmcmc/ directory and check all .py files with pylint
run: |
python -m pylint `find -regextype egrep -regex '(.*src/openmcmc/.*.py)$'` --output-format=parseable:pylint_report.out
- name: Upload pylint results
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: pylint_report
path: pylint_report.out
52 changes: 52 additions & 0 deletions .github/workflows/release_tagging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: ReleaseTag

# Trigger when a python file is changed on main branch either from pull request or push
# but not when only pyproject.toml is changed due to version bump
on:
push:
branches:
- 'main'
paths:
- '**.py'
- '!pyproject.toml'
- 'requirements.txt'

jobs:
# Releases new Python version when Pull Requests are merged into "main"
Release:
runs-on: ubuntu-latest
strategy:
matrix:
# Specify all python versions you might want to perform the actions on
python-version: [ "3.11" ]
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Bump version and commit bumped version back to branch
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.OPENMCMC_TOKEN }}
id: version
run: |
version=$(python .github/bump_version.py)
git config --global user.name 'bump_version'
git config --global user.email 'action@github.com'
git remote set-url origin "https://$GITHUB_ACCESS_TOKEN@github.com/$GITHUB_REPOSITORY"
git commit --signoff -am "Bumped minor version"
git push
echo "BUMPED_VERSION=$(echo v$version)" >> $GITHUB_ENV
echo "New version: $version"
- name: Create Release
run: gh release create ${{ env.BUMPED_VERSION }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.OPENMCMC_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/reuse_compliance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: REUSE Compliance Check

on:
- push

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v2
Loading

0 comments on commit 0966643

Please sign in to comment.