Skip to content

Commit

Permalink
Merge pull request #4 from quantumlib/ci_workflows
Browse files Browse the repository at this point in the history
create prerelease workflow
  • Loading branch information
NoureldinYosri authored Sep 11, 2024
2 parents c6ffd5e + 7e122a8 commit 24a217c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Pre-release TypedUnits

on:
push:
branches:
- main

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build auditwheel patchelf
- name: Build package
run: python -m build
env:
TypedUnits_RELEASE_VERSION: "$(python _version.py).dev$(date "+%Y%m%d%H%M%S")"

- name: Repair Wheel
run: |
auditwheel repair --plat manylinux2014_x86_64 dist/*.whl
rm dist/*.whl
mv wheelhouse/* dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
repository-url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
recursive-include . *pyx
include requirements.txt
include _version.py
4 changes: 4 additions & 0 deletions _version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__version__ = '0.0.1'

if __name__ == '__main__':
print(__version__)
15 changes: 13 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import setuptools
from Cython.Build import cythonize

requirements = open('requirements.txt', 'r').readlines()


_VERSION_KEY = 'TypedUnits_RELEASE_VERSION'
__version__ = os.environ.get(_VERSION_KEY, '')
if not __version__:
# Local build
import _version

__version__ = _version.__version__ + '.dev'


setuptools.setup(
name="tunits",
version="0.0.1",
name="typedunits",
version=__version__,
packages=['tunits.proto', 'tunits.core', 'tunits'],
include_package_data=True,
ext_modules=cythonize(
Expand Down

0 comments on commit 24a217c

Please sign in to comment.