⬆️ Bump the github-actions group with 3 updates (#123) #407
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GH | |
on: | |
pull_request: | |
push: | |
branches: master | |
release: | |
types: [released, prereleased] | |
workflow_dispatch: # allows running workflow manually from the Actions tab | |
jobs: | |
CI: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
if: matrix.python-version != '2.7' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up Python 2 | |
if: matrix.python-version == '2.7' | |
run: | | |
sudo rm -f $(which python) $(which pip) | |
sudo apt-get install python2.7-dev | |
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py | |
python2.7 get-pip.py | |
sudo ln -sf "$(which python2.7)" "$(dirname $(which python2.7))/python" | |
- name: Pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements/*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Pre-commit cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-pre-commit-${{ matrix.python-version }}-${{ hashFiles('**/requirements/ci.txt') }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pre-commit- | |
- name: Install dependencies | |
run: | | |
pip install -U pip setuptools wheel codecov | |
make install | |
- name: Lint | |
if: matrix.python-version == 3.12 | |
run: make lint | |
- name: Test | |
run: make test | |
- name: Codecov | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
run: | | |
codecov | |
CD: | |
needs: CI | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Build | |
run: | | |
pip install -U pip setuptools wheel twine | |
python setup.py sdist bdist_wheel --universal | |
- name: Publish | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USER }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
twine upload dist/* | |
- uses: apexskier/github-release-commenter@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
comment-template: | | |
Released {release_link} |