Skip to content

Commit

Permalink
ci: Add CD and update package name
Browse files Browse the repository at this point in the history
  • Loading branch information
lsetiawan committed Oct 6, 2023
1 parent aafcdcf commit ba57bf0
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 46 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: CD

on:
workflow_dispatch:
push:
branches:
- braingeneers
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
FORCE_COLOR: 3

jobs:
dist:
name: Distribution build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build sdist and wheel
run: pipx run build

- uses: actions/upload-artifact@v3
with:
path: dist

- 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: artifact
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_smart_open
python -c "import smart_open; print(smart_open.__version__)"
echo "=== Done testing wheel file ==="
echo "=== Testing source tar file ==="
# Install tar gz and check import
python -m pip uninstall --yes braingeneers_smart_open
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre --no-binary=braingeneers_smart_open braingeneers_smart_open
python -c "import smart_open; print(smart_open.__version__)"
echo "=== Done testing source tar file ==="
publish:
needs: [dist, test-built-dist]
name: Publish to PyPI
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/[email protected]
if: startsWith(github.ref, 'refs/tags')
45 changes: 0 additions & 45 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def read(fname):
]

setup(
name='smart_open',
name='braingeneers_smart_open',
version=__version__,
description='Utils for streaming large files (S3, HDFS, GCS, Azure Blob Storage, gzip, bz2...)',
long_description=read('README.rst'),
Expand Down

0 comments on commit ba57bf0

Please sign in to comment.