Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init commit for citation. #439

Merged
merged 21 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/check_citation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Version Check

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
RubelMozumder marked this conversation as resolved.
Show resolved Hide resolved

jobs:
check-version:
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.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]

# Check if the CITATION.cff file is valid
- name: Validate CITATION.cff
run: |
cffconvert --validate
- name: Package version
id: package_version
run: |
PACKAGE_VERSION=$(python -c "import pynxtools; print(pynxtools.__version__)")
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "Version from __init__.py: $PACKAGE_VERSION"

- name: Citation version
id: citation_version
run: |
# Parse the version from the CITATION.cff file)
CITATION_VERSION=$(grep '^version:' CITATION.cff | cut -d' ' -f2)
echo "CITATION_VERSION=$CITATION_VERSION" >> $GITHUB_ENV
echo "Version from CITATION.cff: $CITATION_VERSION"

- name: Compare versions
run: |
if [ "$PACKAGE_VERSION" != "$CITATION_VERSION" ]; then
echo "Version mismatch: package version is $PACKAGE_VERSION, CITATION.cff version is $CITATION_VERSION"
exit 1
fi
echo "All versions match: $GIT_TAG_VERSION"

20 changes: 20 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ jobs:
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install build
- name: Git tag version
id: git_tag_version
run: |
# Extract the version from the tag (e.g., 'v1.0.0' becomes '1.0.0')
GIT_TAG_VERSION=${GITHUB_REF#refs/tags/v}
echo "GIT_TAG_VERSION=$GIT_TAG_VERSION" >> $GITHUB_ENV
echo "Version from Git tag: $GIT_TAG_VERSION"
- name: Citation version
id: citation_version
run: |
# Parse the version from the CITATION.cff file
CITATION_VERSION=$(grep '^version:' CITATION.cff | cut -d' ' -f2)
echo "CITATION_VERSION=$CITATION_VERSION" >> $GITHUB_ENV
echo "Version from CITATION.cff: $CITATION_VERSION"
- name: Compare versions
run: |
if [ "$GIT_TAG_VERSION" != "$CITATION_VERSION" ]; then
echo "Version mismatch: Git tag version is $GIT_TAG_VERSION, CITATION.cff version is $CITATION_VERSION"
exit 1
fi
- name: Build package
run: |
git reset --hard HEAD
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ dev = [
"types-requests",
"uv",
"pre-commit",
"cffconvert",
RubelMozumder marked this conversation as resolved.
Show resolved Hide resolved
]
convert = [
"pynxtools[apm,em,mpes,xps,stm,xrd,ellips,raman]",
Expand Down
1 change: 1 addition & 0 deletions src/pynxtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from pynxtools.definitions.dev_tools.globals.nxdl import get_nxdl_version

LOGGER_LEVELS_TO_HIGHLIGHT = (logging.WARNING, logging.ERROR)
__version__ = "0.7.2"
RubelMozumder marked this conversation as resolved.
Show resolved Hide resolved


class CustomFormatter(logging.Formatter):
Expand Down
Loading