Skip to content

[pre-commit.ci] pre-commit autoupdate #168

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #168

name: CI/CD
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
jobs:
unit_testing:
name: Build and Testing
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
env:
KEEPAKEY: ${{ secrets.KEEPAKEY }}
WEAKKEEPAKEY: ${{ secrets.WEAKKEEPAKEY }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install
run: |
pip install .[test] --disable-pip-version-check
python -c "import keepa"
- name: Validate Keys
run: |
python -c "import os, keepa; keepa.Keepa(os.environ.get('KEEPAKEY'))"
- name: Unit testing
run: |
pytest -v --cov keepa --cov-report xml
- uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12'
name: 'Upload coverage to codecov'
- name: Build wheel
if: matrix.python-version == '3.12'
run: |
pip install build --disable-pip-version-check
python -m build
- name: Upload wheel
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: keepa-wheel
path: dist/
retention-days: 1
release:
name: Upload release to PyPI
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [unit_testing]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/keepa
permissions:
id-token: write # this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
- name: Flatten directory structure
run: |
mv dist/*/* dist/
rm -rf dist/keepa-wheel
- name: Display structure of downloaded files
run: ls -R
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
./**/*.whl