Skip to content

Commit

Permalink
Merge pull request #1 from CCP-NC/fix_setup_and_add_new_schema
Browse files Browse the repository at this point in the history
Fix setup and add new schema
  • Loading branch information
Sathya-S3 authored Oct 31, 2024
2 parents 085b1b4 + 7548fb8 commit 831f3f0
Show file tree
Hide file tree
Showing 28 changed files with 1,844 additions and 1,688 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/actions.yaml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: install-and-test
on: [push]

# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
# `contents` is for permission to the contents of the repository.
# `pull-requests` is for permission to pull request
permissions:
contents: write
checks: write
pull-requests: write

jobs:
install-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install --upgrade pip
pip install uv
uv pip install -e '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple --system
uv pip install coveralls --system
- name: mypy
run: |
python -m mypy --ignore-missing-imports --follow-imports=silent --no-strict-optional src/nomad_parser_magres/schema_packages src/nomad_parser_magres/parsers tests
- name: Build coverage file
run: |
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=src tests | tee pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: pytest-coverage.txt
junitxml-path: pytest.xml
- name: Submit to coveralls
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --service=github
build-and-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Build the package
run: |
pip install uv
uv pip install --upgrade pip --system
uv pip install build --system
python -m build --sdist
- name: Install the package
run: |
uv pip install dist/*.tar.gz --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple --system
ruff-linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
args: "check ."
ruff-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
args: "format . --check --verbose"
22 changes: 9 additions & 13 deletions .github/workflows/mkdocs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main # Triggers deployment on push to the main branch

permissions:
contents: write

jobs:
deploy:
Expand All @@ -13,16 +16,9 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material==8.1.1 pymdown-extensions mkdocs-click
- name: Build and Deploy
run: |
mkdocs gh-deploy --force --remote-branch gh-pages
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG_FILE: mkdocs.yml
REQUIREMENTS: requirements_docs.txt
105 changes: 32 additions & 73 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,43 @@
# Upload python package to pypi server and github release.
# Reference: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

name: Upload Python Package
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Build and Publish Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
# publish-to-pypi:
# name: >-
# Publish distribution to PyPI
# runs-on: ubuntu-latest
# environment:
# name: pypi
# url: https://pypi.org/p/nomad-schema-plugin-example
# permissions:
# id-token: write # IMPORTANT: mandatory for trusted publishing
#
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.9"
# - 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: Publish distribution to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
deploy:

github-release:
name: >-
Sign the Python distribution with Sigstore
and upload them to GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- 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: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Install dependencies
run: |
pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
50 changes: 45 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -46,10 +46,12 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
coverage.txt
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -72,6 +74,7 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -82,7 +85,9 @@ profile_default/
ipython_config.py

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand All @@ -91,7 +96,22 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
Expand All @@ -104,12 +124,12 @@ celerybeat.pid
# Environments
.env
.venv
.pyenv
env/
venv/
ENV/
env.bak/
venv.bak/
.pyenv

# Spyder project settings
.spyderproject
Expand All @@ -129,5 +149,25 @@ dmypy.json
# Pyre type checker
.pyre/

# VSCode launch json
# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# VSCode settings
.vscode/launch.json

# comments scripts
comments.py
todos*
questions*
warnings*
important*
Loading

1 comment on commit 831f3f0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_parser_magres
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_parser_magres/parsers
   __init__.py8188%11
   parser.py2482432%7–9, 12–756
src/nomad_parser_magres/parsers/utils
   __init__.py110%19
   utils.py14140%1–32
src/nomad_parser_magres/schema_packages
   __init__.py8275%9–11
   ccpnc_metadata.py27270%1–124
   package.py1061060%1–402
   workflow.py12120%1–43
TOTAL4394107% 

Tests Skipped Failures Errors Time
1 0 💤 0 ❌ 1 🔥 12.027s ⏱️

Please sign in to comment.