Skip to content

CI

CI #2221

Workflow file for this run

name: CI
on:
push:
branches: [master]
tags: [v*]
pull_request:
branches: [master]
pull_request_target:
branches: [master]
schedule:
- cron: 0 4 * * *
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
if: |
(github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') ||
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]')
strategy:
matrix:
py_version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py_version }}
- name: Cache packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py-${{ matrix.py_version }}-${{ hashFiles('setup.py')
}}-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: make setup
- name: Lint
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
make lint
env:
CI_LINT_RUN: 1
- name: Run tests
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
file: .coverage.xml
flags: py${{ matrix.py_version }}
name: codecov
deploy:
name: Release client
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install twine build
- name: Make dist
run: |
python -m build
- name: PyPI upload
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: 1
run: |
twine upload dist/*