Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
57 changes: 5 additions & 52 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,8 @@ on:
default: "develop"

jobs:
test:
name: "🧪 Test with coverage"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.10"]
env:
OS: linux
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "🛍️ Checkout repository"
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: "🐍 Setup Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: "🧪 Run test and generate coverage report"
working-directory: .
run: |
echo "codecov.dev" > VERSION
make test
- name: "📦 Upload coverage artifact"
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.python-version }}
path: ./coverage.xml

upload:
name: "☁️ Upload coverage to Codecov"
runs-on: ubuntu-latest
needs: test
steps:
- name: "🛍️ Checkout repository"
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: "📥 Download coverage artifact"
uses: actions/download-artifact@v4
with:
name: coverage-report-3.10
- name: "☁️ Upload coverage to Codecov"
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_UPLOAD_TOKEN_MMIF_PYTHON }}
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: coverage
fail_ci_if_error: true

test-and-codecov:
name: "🤙 Call SDK test workflow"
uses: clamsproject/.github/.github/workflows/sdk-codecov.yml@main
secrets:
CC_REPO_UPLOAD_TOKEN: ${{ secrets.CODECOV_UPLOAD_TOKEN_MMIF_PYTHON }}
51 changes: 4 additions & 47 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,7 @@ on:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
build-and-upload:
name: "📦 Upload documentation, PyPI distribution"
runs-on: ubuntu-latest
env:
OS: linux
PYTHON: '3.10'
steps:
- name: "🏷 Prepare package metadata"
run: |
echo "VERSION=$(echo "${{ github.ref }}" | cut -d/ -f3)" >> $GITHUB_ENV
echo "PACKAGE=$(echo "${{ github.repository }}" | cut -d/ -f2 | tr '-' '_')" >> $GITHUB_ENV
- name: "🛍 Checkout repository"
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: "🐍 Setup Python"
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: "🏗 Build sdist"
run: |
echo ${{ env.VERSION }} > VERSION
python3 -c "import setuptools; print(setuptools.__version__)"
python3 -m pip install setuptools~=69.3 # this version fully conforms PEP-625 and applies wheel name convention to sdist as well
make package
make test
- name: "🗞️ Build HTML documentation"
run: |
make docs
- name: "📓 Generate changelog"
run: |
for pr in $(gh pr list -L 1000 -s merged | grep -E "^[0-9]+\s+releas" | cut -f 1 ); do gh pr view $pr --json title,body,mergedAt --template '{{printf "\n"}}## {{.title}} ({{timefmt "2006-01-02" .mergedAt}}){{printf "\n"}}{{.body}}{{printf "\n"}}'; done > CHANGELOG.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "🫙 Commit and push documentation files"
run: |
git config --local user.email "admin@clams.ai"
git config --local user.name "clams-bot"
for f in docs documentation CHANGELOG.md; do if [ -e $f ]; then git add $f; fi; done
git add -u docs
git commit -m 'adding HTML documentation for publication'
git push origin HEAD:main
- name: "☁️ Upload to PyPI"
run: |
if [ -d dist ]; then twine upload -u __token__ -p ${{ secrets.PYPITOKEN }} dist/${{ env.PACKAGE }}-${{ env.VERSION }}.tar.gz ; fi
package-and-upload:
name: "🤙 Call SDK publish workflow"
uses: clamsproject/.github/.github/workflows/sdk-publish.yml@main
secrets: inherit
1 change: 1 addition & 0 deletions requirements.dev
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ sphinx-autobuild
git+https://github.com/clamsproject/sphinx-multiversion.git@master
twine
m2r2
setuptools>=70 # arbitrarily recent version
46 changes: 26 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from urllib import request

import setuptools.command.build_py
import setuptools.command.develop
from setuptools.command.sdist import sdist
from setuptools.command.develop import develop

name = "mmif-python"
version_fname = "VERSION"
Expand Down Expand Up @@ -254,15 +255,18 @@ def mod_run(self):
return setuptools_cmd


# Modernize cmdclass to ensure compatibility with setuptools >=80
@prep_ext_files
class SdistCommand(setuptools.command.sdist.sdist):
pass

class SdistCommand(sdist):
def initialize_options(self):
super().initialize_options()
# Add any additional initialization logic here if needed

@prep_ext_files
class DevelopCommand(setuptools.command.develop.develop):
pass

class DevelopCommand(develop):
def initialize_options(self):
super().initialize_options()
# Add any additional initialization logic here if needed

cmdclass['sdist'] = SdistCommand
cmdclass['develop'] = DevelopCommand
Expand All @@ -279,6 +283,17 @@ class DevelopCommand(setuptools.command.develop.develop):
with open('requirements.seq') as requirements:
seq_requires = requirements.readlines()

extras_require = {
'seq': seq_requires,
'cv': cv_requires,
'dev': [
'pytest',
'pytest-pep8',
'pytest-cov',
'pytype',
]
}

setuptools.setup(
name=name,
version=version,
Expand All @@ -301,21 +316,12 @@ class DevelopCommand(setuptools.command.develop.develop):
'mmif': [f'{mmif_res_pkg}/*', f'{mmif_ver_pkg}/*', f'{mmif_vocabulary_pkg}/*'],
},
install_requires=requires,
extras_require={
'seq': seq_requires,
'cv': cv_requires,
'dev': [
'pytest',
'pytest-pep8',
'pytest-cov',
'pytype',
]
},
extras_require=extras_require,
python_requires='>=3.10',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers ',
'License :: OSI Approved :: Apache Software License',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: Apache-2.0',
'Programming Language :: Python :: 3 :: Only',
]
)
Loading