Skip to content

Commit 759ebab

Browse files
committed
[ci] upload package to pypi, bump to 0.5.1
1 parent bcac7f4 commit 759ebab

7 files changed

Lines changed: 52 additions & 8 deletions

File tree

.github/check-pypi-upload.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
PYPKG_BUILD_VERSION=$(awk -F"-" '{ print $2 }' <<< $(ls dist/ | head -1))
3+
PYPKG_VERSIONS_STRING=$(pip index versions bjdata | grep versions:)
4+
PYPKG_VERSIONS_STRING=${PYPKG_VERSIONS_STRING#*:}
5+
UPLOAD_TO_PYPI=1
6+
while IFS=', ' read -ra PYPKG_VERSIONS_ARRAY; do
7+
for VERSION in "${PYPKG_VERSIONS_ARRAY[@]}"; do
8+
if [ "$PYPKG_BUILD_VERSION" = "$VERSION" ]; then
9+
UPLOAD_TO_PYPI=0
10+
fi
11+
done;
12+
done <<< "$PYPKG_VERSIONS_STRING"
13+
if [ "$UPLOAD_TO_PYPI" = 1 ]; then
14+
echo "Wheel version wasn't found on PyPi.";
15+
else
16+
echo "Wheel was found on PyPi.";
17+
fi
18+
echo "perform_pypi_upload=$UPLOAD_TO_PYPI" >> $GITHUB_OUTPUT

.github/workflows/run_test.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,26 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
python -m pip install --upgrade pip
35-
pip install coverage numpy setuptools
35+
pip install coverage numpy setuptools build
3636
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3737
- name: Build, run test and coverage
3838
run: |
39+
rm -rf dist/*
3940
./coverage_test.sh
40-
- name: Build sdist
41+
- name: Build wheel
42+
run: python3 -m build
43+
- name: Build wheel
44+
run: rm -rf dist/bjdata-*.whl
45+
- name: Check If the Build Version Exists on PyPI
46+
id: perform_pypi_upload_check
47+
shell: bash
4148
run: |
42-
python setup.py sdist
49+
$GITHUB_WORKSPACE/.github/check-pypi-upload.sh
50+
- name: Upload packages to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
if: ${{ github.actor == 'fangq' && steps.perform_pypi_upload_check.outputs.perform_pypi_upload == 1 && github.event_name != 'pull_request'}}
53+
with:
54+
password: ${{ secrets.PYPI_API_TOKEN }}
55+
verify_metadata: false
56+
verbose: true
57+
skip_existing: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Copyright: (C) Qianqian Fang (2020-2025) <q.fang at neu.edu>
66
- Copyright: (C) Iotic Labs Ltd. (2016-2019) <vilnis.termanis at iotic-labs.com>
77
- License: Apache License, Version 2.0
8-
- Version: 0.5.0
8+
- Version: 0.5.1
99
- URL: https://pypi.org/project/bjdata/
1010
- Github: https://github.com/NeuroJSON/pybj
1111
- BJData Spec Version: [V1 Draft 3](https://neurojson.org/bjdata/draft3)

bjdata/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from .encoder import EncoderException
4141
from .decoder import DecoderException
4242

43-
__version__ = "0.5.0"
43+
__version__ = "0.5.1"
4444

4545
__all__ = (
4646
"EXTENSION_ENABLED",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def build_extension(self, ext):
8080

8181
setup(
8282
name="bjdata",
83-
version="0.5.0",
83+
version="0.5.1",
8484
description="Binary JData and UBJSON encoder/decoder",
8585
long_description=load_description("README.md"),
8686
long_description_content_type="text/markdown",

test/perf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Copyright (c) 2020-2025 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
12
# Copyright (c) 2019 Iotic Labs Ltd. All rights reserved.
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,10 +13,16 @@
1213
# See the License for the specific language governing permissions and
1314
# limitations under the License.
1415

16+
1517
from __future__ import print_function, unicode_literals
1618

19+
from sys import argv, exit, path # pylint: disable=redefined-builtin
20+
import os
21+
22+
# Add project_root to sys.path
23+
path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
24+
1725
from abc import ABCMeta, abstractmethod
18-
from sys import argv, exit # pylint: disable=redefined-builtin
1926
from traceback import print_exc
2027
from types import GeneratorType
2128
from contextlib import contextmanager

test/test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
from sys import version_info, getrecursionlimit, setrecursionlimit, path
17+
import os
18+
19+
# Add project_root to sys.path
20+
path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
1621

17-
from sys import version_info, getrecursionlimit, setrecursionlimit
1822
from functools import partial
1923
from io import BytesIO, SEEK_END
2024
from unittest import TestCase, skipUnless

0 commit comments

Comments
 (0)