Skip to content

chore(deps): bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 (… #45

chore(deps): bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 (…

chore(deps): bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 (… #45

Workflow file for this run

name: Build
on:
push:
branches: [main]
tags:
- v*
# Required shell entrypoint to have properly activated conda environments
defaults:
run:
shell: bash -l {0}
jobs:
check:
name: Run checks for GutenTAG on ubuntu with python 3.7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
use-mamba: true
auto-update-conda: true
python-version: "3.7"
- name: Install dependencies
run: |
pip install -r requirements.dev
- name: Typcheck with mypy
run: |
python setup.py typecheck
- name: Lint with flake8
run: |
flake8 . --count --show-source --statistics
test:
name: Test GutenTAG on ${{ matrix.os }} with python ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 3
matrix:
os: [ubuntu-latest] # [ubuntu-latest, windows-latest, macOS-latest]
python_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
use-mamba: true
auto-update-conda: true
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install -r requirements.dev
- name: Test with pytest
run: |
python setup.py test
- name: Extract test coverage
if: ${{ matrix.python_version == '3.11' && matrix.os == 'ubuntu-latest' }}
run: |
SUMMARY=$(sed -n "s/^<coverage.*line-rate=\"\([0-9.]*\)\".*>$/\1/p" coverage.xml)
echo "COVERAGE=$(echo ${SUMMARY})" >> $GITHUB_ENV
echo "Extracted coverage data: ${COVERAGE}"
REF=${{ github.ref }}
IFS='/' read -ra PATHS <<< "$REF"
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
echo "Extracted branch name: $BRANCH_NAME"
- name: Create coverage badge
if: ${{ matrix.python_version == '3.11' && matrix.os == 'ubuntu-latest' }}
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 6762bee806477c52e079f21d2f252688
filename: gutentag__${{ env.BRANCH }}.json
label: Test Coverage
message: ${{ env.COVERAGE }}
color: green
namedLogo: pytest
- name: Upload Coverage to Codecov
if: ${{ matrix.python_version == '3.11' && matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: coverage.xml
flags: unittests
build-source-distribution:
name: Build source distribution
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- test
- check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
use-mamba: true
auto-update-conda: true
python-version: 3.7
- name: Build source distribution
run: |
python setup.py sdist
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages-source
path: dist
build-manylinux-wheels:
name: Build manylinux wheels
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- test
- check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build manylinux Python wheels
uses: RalfG/[email protected]_x86_64
with:
# our wheel is purely python, so this creates a *-none-any.wheel and other versions are not required for now
python-versions: 'cp37-cp37m'
- name: List packages
run: |
ls -alh dist
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages-manylinux
path: dist/*.whl
publish:
name: Publish distributions
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [build-source-distribution, build-manylinux-wheels]
runs-on: ubuntu-latest
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
path: dist
- name: Restore original folder structure of dist
run: |
find dist -type f -exec mv {} dist/ \;
find dist/* -type d -exec rmdir {} \; || true
- name: Publish package to PyPi
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}