Skip to content

Commit c382081

Browse files
committed
Initial setup of repo
0 parents  commit c382081

File tree

207 files changed

+16936
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+16936
-0
lines changed

.github/workflows/main.yml

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
2+
name: CI Pipeline
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
name: Docker Build and Push
16+
if: github.event_name != 'pull_request'
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v1
23+
24+
- name: Log in to Docker Hub
25+
env:
26+
DOCKER_REGISTRY_USER: ${{ secrets.CI_REGISTRY_USER }}
27+
DOCKER_REGISTRY_PASSWORD: ${{ secrets.CI_REGISTRY_PASSWORD }}
28+
run: echo "${DOCKER_REGISTRY_PASSWORD}" | docker login -u "${DOCKER_REGISTRY_USER}" --password-stdin
29+
30+
- name: Build and push Docker image
31+
run: |
32+
export IMAGE_NAME=${{ secrets.CI_REGISTRY_IMAGE }}
33+
docker build -t $IMAGE_NAME:${{ github.ref_name }} .
34+
docker push $IMAGE_NAME:${{ github.ref_name }}
35+
env:
36+
DOCKER_BASE: ${{ secrets.DOCKER_BASE }}
37+
38+
test:
39+
runs-on: ubuntu-latest
40+
name: Run Tests
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v2
44+
45+
- name: Set up Python
46+
uses: actions/setup-python@v2
47+
with:
48+
python-version: '3.x'
49+
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install pytest coverage
54+
55+
- name: Run pytest
56+
run: |
57+
pytest --cov=martepy --cov-report=term --cov-report=html:cov_html --cov-fail-under=90
58+
- name: Upload Coverage Report
59+
uses: actions/upload-artifact@v2
60+
with:
61+
name: coverage-report
62+
path: cov_html/
63+
retention-days: 30
64+
65+
linting:
66+
runs-on: ubuntu-latest
67+
name: Code Linting
68+
steps:
69+
- name: Checkout repository
70+
uses: actions/checkout@v2
71+
72+
- name: Set up Python
73+
uses: actions/setup-python@v2
74+
with:
75+
python-version: '3.x'
76+
77+
- name: Install pylint
78+
run: pip install pylint
79+
80+
- name: Run pylint
81+
run: pylint martepy
82+
83+
docs:
84+
runs-on: ubuntu-latest
85+
name: Build Documentation
86+
if: github.ref == 'refs/heads/main'
87+
steps:
88+
- name: Checkout repository
89+
uses: actions/checkout@v2
90+
91+
- name: Set up Python
92+
uses: actions/setup-python@v2
93+
with:
94+
python-version: '3.x'
95+
96+
- name: Install dependencies
97+
run: |
98+
pip install -r requirements.txt
99+
pip install sphinx
100+
101+
- name: Build HTML docs
102+
run: |
103+
cd docs
104+
make html
105+
106+
- name: Upload Documentation
107+
uses: actions/upload-artifact@v2
108+
with:
109+
name: documentation
110+
path: docs/build/html
111+
retention-days: 7
112+
113+
pages:
114+
runs-on: ubuntu-latest
115+
name: Deploy Documentation to Pages
116+
if: github.ref == 'refs/heads/main'
117+
steps:
118+
- name: Checkout repository
119+
uses: actions/checkout@v2
120+
121+
- name: Copy documentation to public folder
122+
run: |
123+
mkdir -p public
124+
rm -rf public/*
125+
cp -a docs/build/html/* public/
126+
127+
- name: Upload Pages Artifact
128+
uses: actions/upload-artifact@v2
129+
with:
130+
name: pages
131+
path: public/
132+
retention-days: 365

.github/workflows/python-publish.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.x'
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build
33+
- name: Build package
34+
run: python -m build
35+
- name: Publish package
36+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
37+
with:
38+
user: __token__
39+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
scratch/
2+
*.pyc
3+
*.swp
4+
*.csv
5+
build/
6+
*.egg-info/
7+
**/__pycache__/*
8+
**/.vscode/*
9+
htmlcov/*
10+
*.cfg
11+
.coverage
12+
.vs/*
13+
.ruff_cache/*
14+
.pytest_cache/*
15+
docs/doxygen/*
16+
docs/log
17+
docs/public/*
18+
coverage.txt
19+
tests/marte2/headers_out/*
20+
public/*
21+
codeclimate.json
22+
log.txt
23+
tests/marte2/new_headers/*
24+
**/*.xmt

.gitlab-ci.yml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
stages:
2+
- docker
3+
- tests
4+
- quality
5+
- docs
6+
- deploy
7+
8+
docker:
9+
stage: docker
10+
image: docker:19.03.12
11+
services:
12+
- docker:19.03.12-dind
13+
tags:
14+
- lower-privacy
15+
- docker
16+
- ubuntu
17+
- meta
18+
script:
19+
- export IMAGE_NAME=$CI_REGISTRY_IMAGE
20+
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
21+
- cd tests && docker build -t $IMAGE_NAME:$CI_COMMIT_REF_NAME .
22+
- docker push $IMAGE_NAME
23+
rules:
24+
- if: $CI_COMMIT_TAG
25+
when: never
26+
- if: $DOCKER_BASE
27+
when: always
28+
- when: never
29+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
30+
when: never
31+
32+
test:
33+
stage: tests
34+
image: git.ccfe.ac.uk:4567/marte21/public/marte2_python:develop
35+
script:
36+
- pytest --cov=martepy --cov-report=term --cov-report=html:cov_html --cov-fail-under=90
37+
tags:
38+
- lower-privacy
39+
- docker
40+
- ubuntu
41+
- meta
42+
artifacts:
43+
paths:
44+
- cov_html/
45+
expire_in: 30 days
46+
when: always
47+
48+
linting:
49+
stage: quality
50+
image: git.ccfe.ac.uk:4567/marte21/public/marte2_python:develop
51+
script:
52+
- pylint martepy
53+
tags:
54+
- lower-privacy
55+
- docker
56+
- ubuntu
57+
- meta
58+
when: always
59+
60+
docs:
61+
stage: docs
62+
image: git.ccfe.ac.uk:4567/marte21/public/marte2_python:develop
63+
script:
64+
- cd docs
65+
- make html
66+
tags:
67+
- lower-privacy
68+
- docker
69+
- ubuntu
70+
- meta
71+
artifacts:
72+
paths:
73+
- docs/build/html
74+
expire_in: 1 week
75+
rules:
76+
- if: '$CI_COMMIT_BRANCH == "main"'
77+
when: always
78+
79+
pages:
80+
stage: deploy
81+
script:
82+
- mkdir -p public/
83+
- rm -rf public/*
84+
- cp -a docs/build/html/* public/
85+
tags:
86+
- lower-privacy
87+
- docker
88+
- ubuntu
89+
- meta
90+
artifacts:
91+
paths:
92+
- public/
93+
expire_in: 1 year
94+
rules:
95+
- if: '$CI_COMMIT_BRANCH == "main"'
96+
when: always

Guidelines.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Guidelines
2+
3+
## Community Guidelines
4+
5+
This is a community provided Custom Device and we prescribe to the ideals and concepts outlined in the Python Software Foundation Code of Conduct. By contributing or using this repository you are also prescribing to behave accordingly as set out in the code of conduct within this respository.
6+
7+
https://policies.python.org/python.org/code-of-conduct/
8+
9+
## Contributor Guidelines
10+
11+
If you believe you have found an issue in the software, please report this as an issue. If you believe you have fixed an issue then open a issue as well as a merge request.
12+
13+
**This repository is not intended to be officially supported by UKAEA, if you want an issue fixed, the best way to do so is to create the fix yourself and then submit the fix as a merge request. We will try to maintain support as best way can but provide no gauranetees onto fixing an issue or a timeframe to do so.**
14+
15+
## Style Guidelines
16+
17+
The style of how this repository is coded is strictly controlled by the pipeline process with pylint verifying code submissions. The general rules of pylint for our repository are:
18+
19+
- No line longer than 100 characters: Use multi-line methods in python to avoid these and try to break out code actions to avoid long lines.
20+
21+
- No overly nested branches of logic: Try to avoid this where possible however it is understood this can be required so it is allowed to override the warning with pylint ignore commenting.
22+
23+
- No more than 15 local variables in a function.
24+
25+
- All classes, functions and files must have comments providing definitions.
26+
27+
For naming conventions we have:
28+
29+
- Class: PascalCase
30+
- Constants: UPPERCASE
31+
- Function/Method: camelCase
32+
- Function Arguments: snake_case
33+
- Variable: Any
34+
- Attribute: Any
35+
36+
**If you add new code then it is expected that you build a corresponding set of pytests to ensure that it is functional. This is useful in iterating software to ensure that this code is always functional without requiring developer time successively.**

LICENSE

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Copyright 2024 UKAEA
2+
3+
Licensed under the EUPL, Version 1.1 or - subsequent versions of the EUPL (the "Licence"). You may not use this work except in compliance with the Licence. You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
4+
5+
Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Licence permissions and limitations under the Licence.

0 commit comments

Comments
 (0)