Skip to content

Release

Release #4

name: Release
on:
release:
types: [ created ]
workflow_dispatch:
jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install flake8
run: |
python -m pip install --upgrade pip
python -m pip install flake8
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ windows-latest, macos-latest ]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov
python -m pip install -r requirements.txt
python -m pip install build twine
- name: Build
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
./build.cmd
else
chmod +x ./build.sh && ./build.sh
fi
- name: Find Correct Build
id: findbuild
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
output=__pyfastutil.pyd
else
output=__pyfastutil.so
fi
echo "::set-output name=libname::$output"
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}_py${{ matrix.python-version }}-${{ steps.findbuild.outputs.libname }}
path: pyfastutil/${{ steps.findbuild.outputs.libname }}
- name: Test with pytest and generate coverage report
run: |
pytest --cov=your_package_name --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
- name: Upload to PyPI
shell: bash
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
./upload.cmd
else
chmod +x ./upload.sh && ./upload.sh
fi