Skip to content

Commit

Permalink
Publish bdist_wheel alongside sdist (#7)
Browse files Browse the repository at this point in the history
Test bdist_wheel distribution in CI.
Update setuptools and install wheel for publish workflow and tests.
  • Loading branch information
CasperWA authored Nov 20, 2020
1 parent 5188c98 commit ffe44f2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,19 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install Python requirements
run: pip install -r requirements.txt
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -r requirements.txt
- name: Check build and installation of PyPI source distribution
env:
SDIST_DIR: sdist_action
BDIST_DIR: bdist_action
run: |
python setup.py -v sdist -d ${SDIST_DIR}
python setup.py -v sdist -d ${SDIST_DIR} bdist_wheel -d ${BDIST_DIR}
SDIST_FILE=$( ls ${SDIST_DIR}/ )
echo "BDIST_FILE=$( ls ${BDIST_DIR}/ )" >> $GITHUB_ENV
ORIGINAL_PWD=$(pwd)
mkdir -p /tmp/installation_dir
Expand All @@ -81,3 +86,23 @@ jobs:
- name: Assert nbextension installed correctly
run: ./.github/static/check_nbextensions.py

- name: Remove installation again
run: pip uninstall -y ipywidgets-extended

- name: Ensure it was removed as an nbextension
run: ./.github/static/check_nbextensions.py && exit 1 || ( echo "Failed as expected" ; exit 0 )

- name: Re-install wheel
env:
BDIST_DIR: bdist_action
run: |
ORIGINAL_PWD=$(pwd)
if [ "${ORIGINAL_PWD}" == "/tmp/installation_dir" ]; then echo "Wrong original dir: ${ORIGINAL_PWD}"; exit 1; fi
mkdir -p /tmp/installation_dir
cd /tmp/installation_dir
pip install ${ORIGINAL_PWD}/${BDIST_DIR}/${{ env.BDIST_FILE }}
- name: Assert nbextension installed correctly
run: ./.github/static/check_nbextensions.py
9 changes: 5 additions & 4 deletions .github/workflows/publish-on-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
if: github.repository == 'CasperWA/ipywidgets-extended' && startsWith(github.ref, 'refs/tags/v')
env:
PUBLISH_UPDATE_BRANCH: main
PY_DIST_DIR: py_dist

steps:
- name: Checkout repository
Expand All @@ -29,7 +30,7 @@ jobs:
- name: Update setuptools and install requirements
run: |
python -m pip install --upgrade pip
pip install -U setuptools
pip install -U setuptools wheel
pip install -r requirements.txt
- name: Update version and tag
Expand All @@ -44,19 +45,19 @@ jobs:
tags: true

- name: Build source distribution
run: python setup.py -v sdist -d py_dist
run: python setup.py -v sdist -d ${{ env.PY_DIST_DIR }} bdist_wheel -d ${{ env.PY_DIST_DIR }}

- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
packages_dir: py_dist/
packages_dir: ${{ env.PY_DIST_DIR }}/

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
packages_dir: py_dist/
packages_dir: ${{ env.PY_DIST_DIR }}/

0 comments on commit ffe44f2

Please sign in to comment.