Skip to content

Release

Release #3

Workflow file for this run

name: Release
on:
release:
types: [published]
branches:
- "main"
jobs:
lint-docs:
name: Lint & Docs ubuntu-latest Py3.12
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install package
# conda setup requires this special shell
shell: bash -l {0}
run: |
python -m pip install . --no-deps
conda list
- name: Linting Dependencies
shell: bash
run: |
python -m pip install -U black flake8
- name: Run linters
shell: bash -l {0}
run: |
black --check --diff thrivescraper
flake8 thrivescraper
- name: Documentation Dependencies
shell: bash
run: |
python -m pip install -U Sphinx sphinx-rtd-theme
- name: Documentation
shell: bash -l {0}
run: |
make html
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
# if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
test:
name: Test ${{ matrix.os }} Py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: lint-docs
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Testing Dependencies
shell: bash
run: |
python -m pip install -U pytest pytest-cov codecov
- name: Install package
shell: bash
run: |
python -m pip install .
- name: Run tests
shell: bash -l {0}
run: |
pytest -v --cov=${{ inputs.src }} --cov-report=xml --color=yes tests/
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: CodeCov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
deploy:
name: PyPi ubuntu-latest Py3.12
# Run only for tagged releases publishing development or release candidates
# only to test.pypi, otherwise to both it and the main pypi.
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [lint-docs, test]
environment:
name: pypi
url: https://pypi.org/project/thrive
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python "3.12"
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install package
shell: bash -l {0}
run: |
python -m pip install . --no-deps
- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
ls -l dist/
- name: Publish distribution 📦 to PyPI
if: contains(github.ref, 'dev') == false && contains(github.ref, 'rc') == false
uses: pypa/gh-action-pypi-publish@release/v1