SuperCowPowers / sageworks

SageWorks: An easy to use Python API for creating and deploying AWS SageMaker Models
https://www.supercowpowers.com
MIT License
39 stars 1 forks source link

GitHub Actions: Python Package and Publish Python Package #41

Open brifordwylie opened 1 year ago

brifordwylie commented 1 year ago

So Python Package will test code on different Python versions and the Publish action will automatically publish a new PYPI version, both are good, do them.

brifordwylie commented 8 months ago

So we're going to push this into the next release.. the big thing here is how we run tests that interact with AWS. There's another ticket #181 that talks about Moto for mocking AWS.. shrug.. we might use that...

name: Python Tox Testing

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9, 3.10]

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install tox
      run: pip install tox
    - name: Run tox
      run: tox

and

name: Publish to PyPI

on:
  release:
    types: [created]

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.x'
    - name: Install dependencies
      run: pip install build twine
    - name: Build package
      run: python -m build
    - name: Publish to PyPI
      uses: pypa/gh-action-pypi-publish@v1.4.2
      with:
        password: ${{ secrets.PYPI_API_TOKEN }}