Skip to content

Commit

Permalink
ci: Add built dist test step for cd
Browse files Browse the repository at this point in the history
  • Loading branch information
lsetiawan committed Sep 15, 2023
1 parent ff5c3e3 commit c3ade4f
Showing 1 changed file with 45 additions and 5 deletions.
50 changes: 45 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,50 @@ jobs:

- name: Check products
run: pipx run twine check dist/*

test-built-dist:
needs: [dist]
name: Test built distribution
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/[email protected]
name: Install Python
with:
python-version: 3.10
- uses: actions/download-artifact@v3
with:
name: releases
path: dist
- name: List contents of built dist
run: |
ls -ltrh
ls -ltrh dist
- name: Publish to Test PyPI
uses: pypa/[email protected]
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
skip-existing: true
- name: Check pypi packages
run: |
sleep 3
python -m pip install --upgrade pip
echo "=== Testing wheel file ==="
# Install wheel to get dependencies and check import
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre braingeneers
python -c "import braingeneers; print(braingeneers.__version__)"
echo "=== Done testing wheel file ==="
echo "=== Testing source tar file ==="
# Install tar gz and check import
python -m pip uninstall --yes braingeneers
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre --no-binary=:all: braingeneers
python -c "import braingeneers; print(braingeneers.__version__)"
echo "=== Done testing source tar file ==="
publish:
needs: [dist]
Expand All @@ -55,8 +99,4 @@ jobs:
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release' && github.event.action == 'published'
with:
# Remember to tell (test-)pypi about this repo before publishing
# Remove this line to publish to PyPI
repository-url: https://test.pypi.org/legacy/
if: startsWith(github.ref, 'refs/tags')

0 comments on commit c3ade4f

Please sign in to comment.