-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Build and upload to PyPI | ||
|
||
on: | ||
push: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
run_tests: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v3 | ||
|
||
- name: Install | ||
run: python3 -m pip install . | ||
|
||
- name: Run runtime pytest | ||
run: pytest tests | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v3 | ||
|
||
- name: Set version number | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
run: echo "VERSION = \"${GITHUB_REF_NAME:1}\"" > opuscleaner/__about__.py | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: sdist | ||
path: dist/opuscleaner-*.tar.gz | ||
|
||
build_wheels: | ||
name: Build wheels | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v3 | ||
|
||
- name: Set version number | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
run: echo "VERSION = \"${GITHUB_REF_NAME:1}\"" > opuscleaner/__about__.py | ||
|
||
- name: Build wheels | ||
run: python -m pip wheel -w wheelhouse . | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels | ||
path: ./wheelhouse/opuscleaner-*.whl | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdist | ||
path: dist | ||
|
||
- uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
name: Testing (CI/CD) | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: pip | ||
|
||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
|
||
- name: Install requirements | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
pip install pre-commit ruff pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with pre-commit | ||
run: pre-commit run --all-files | ||
|
||
- name: Test with pytest | ||
run: pytest tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
[build-system] | ||
requires = ["hatchling", "hatch-requirements-txt"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "opuspocus" | ||
description = "Modular NLP pipeline manager." | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
license = "MIT" | ||
keywords = ["OPUS", "HPLT", "pipeline manager"] | ||
authors = [ | ||
{ name = "Dušan Variš", email = "[email protected]" }, | ||
] | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
] | ||
dynamic = [ | ||
"version", | ||
"dependencies", | ||
"optional-dependencies" | ||
] | ||
|
||
[project.scripts] | ||
opuspocus = "go:main_cli" | ||
|
||
[project.urls] | ||
Documentation = "https://github.com/hplt-project/opuspocus#readme" | ||
Issues = "https://github.com/hplt-project/opuspocus/issues" | ||
Repository = "https://github.com/hplt-project/OpusPocus.git" | ||
|
||
[tool.hatch.version] | ||
path = "opuspocus/__about__.py" | ||
|
||
[tool.hatch.envs.default] | ||
dependencies = [ | ||
"pytest", | ||
"pytest-cov", | ||
] | ||
[tool.hatch.envs.default.scripts] | ||
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=opuspocus --cov=tests {args}" | ||
no-cov = "cov --no-cov {args}" | ||
|
||
[[tool.hatch.envs.test.matrix]] | ||
python = ["37", "38", "39", "310", "311"] | ||
|
||
[tool.hatch.build] | ||
include = [ | ||
"/opuspocus", | ||
] | ||
|
||
[tool.hatch.metadata.hooks.requirements_txt] | ||
files = ["requirements.txt"] | ||
|
||
[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies] | ||
all = ["requirements-all.txt"] | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
parallel = true | ||
omit = [ | ||
"opuspocus/__about__.py", | ||
] | ||
|
||
[tool.coverage.report] | ||
exclude_lines = [ | ||
"no cov", | ||
"if __name__ == .__main__.:", | ||
"if TYPE_CHECKING:", | ||
] |