From 8fa11fa05a8cbdcbfa0d3034ee2e16c47842f274 Mon Sep 17 00:00:00 2001 From: Artur Glavic Date: Wed, 30 Oct 2024 14:07:48 +0100 Subject: [PATCH] add configuration for pypi release --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ pyproject.toml | 6 ++++ setup.cfg | 31 ++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 pyproject.toml create mode 100644 setup.cfg diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4031fab --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + tags: + - "*" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + inputs: + build-items: + description: 'Items to be build' + required: true + default: 'all' + type: choice + options: + - all + - windows + - linux + - mac + +jobs: + build-ubuntu-latest: + runs-on: ubuntu-latest + if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all", "linux"]'), github.event.inputs.build-items)) }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + pip install -r requirements.txt + - name: Build PyPI package + run: | + python3 -m build + - name: Upload to PyPI + if: github.event_name != 'workflow_dispatch' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + skip-existing: true + - name: Archive distribution + uses: actions/upload-artifact@v4 + with: + name: linux-dist + path: | + genx/dist/*.tar.gz diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..374b58c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..eab70bb --- /dev/null +++ b/setup.cfg @@ -0,0 +1,31 @@ +[bdist_wheel] +universal = 1 + +[metadata] +name = amor_eos +version = attr: libeos.__version__ +author = Jochen Stahn - Paul Scherrer Institut +author_email = jochen.stahn@psi.ch +description = EOS reflectometry reduction for AMOR instrument +license = MIT +classifiers = + Programming Language :: Python :: 3 + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Topic :: Scientific/Engineering + Development Status :: 5 - Production/Stable + +[options] +python_requires = >=3.8 +packages = + libeos +scripts = + eos.py +install_requires = + numpy + h5py + orsopy + numba + +[project.urls] +Homepage = "https://github.com/jochenstahn/amor"