dc451401ca
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.3.5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.3.5) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
173 lines
5.2 KiB
YAML
173 lines
5.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- '[0-9].[0-9]+' # matches to backport branches, e.g. 3.6
|
|
tags: [ 'v*' ]
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- '[0-9].[0-9]+'
|
|
- 'update/pre-commit-autoupdate'
|
|
schedule:
|
|
- cron: '0 6 * * *' # Daily 6AM UTC build
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
name: Linter
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2.3.5
|
|
- name: Setup Python 3.9
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
#----------------------------------------------
|
|
# ----- install & configure poetry -----
|
|
#----------------------------------------------
|
|
- name: Install Poetry
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
installer-parallel: true
|
|
#----------------------------------------------
|
|
# load cached venv if cache exists
|
|
#----------------------------------------------
|
|
- name: Load cached venv
|
|
id: cached-poetry-dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
|
#----------------------------------------------
|
|
# install dependencies if cache does not exist
|
|
#----------------------------------------------
|
|
- name: Install dependencies
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
run: poetry install --no-interaction --no-root
|
|
#----------------------------------------------
|
|
# install your root project, if required
|
|
#----------------------------------------------
|
|
- name: Install library
|
|
run: poetry install --no-interaction
|
|
#----------------------------------------------
|
|
# run test suite
|
|
#----------------------------------------------
|
|
- name: Run linter
|
|
run: |
|
|
make lint
|
|
# - name: Prepare twine checker
|
|
# run: |
|
|
# pip install -U twine wheel
|
|
# python setup.py sdist bdist_wheel
|
|
# - name: Run twine checker
|
|
# run: |
|
|
# twine check dist/*
|
|
|
|
test-unix:
|
|
name: Test Unix
|
|
needs: lint
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
pyver: [3.6, 3.7, 3.8, 3.9, pypy3]
|
|
redismod: ["edge", "preview", "latest"]
|
|
fail-fast: false
|
|
services:
|
|
redis:
|
|
image: redislabs/redismod:${{ matrix.redismod }}
|
|
ports:
|
|
# Maps port 6379 on service container to the host
|
|
- 6379:6379
|
|
# Set health checks to wait until redis has started
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 15
|
|
env:
|
|
OS: ${{ matrix.os }}
|
|
INSTALL_DIR: ${{ github.workspace }}/redis
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2.3.5
|
|
- name: Setup Python ${{ matrix.pyver }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.pyver }}
|
|
#----------------------------------------------
|
|
# ----- install & configure poetry -----
|
|
#----------------------------------------------
|
|
- name: Install Poetry
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
installer-parallel: true
|
|
#----------------------------------------------
|
|
# load cached venv if cache exists
|
|
#----------------------------------------------
|
|
- name: Load cached venv
|
|
id: cached-poetry-dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
|
#----------------------------------------------
|
|
# install dependencies if cache does not exist
|
|
#----------------------------------------------
|
|
- name: Install dependencies
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
run: poetry install --no-interaction --no-root
|
|
#----------------------------------------------
|
|
# install your root project, if required
|
|
#----------------------------------------------
|
|
- name: Install library
|
|
run: poetry install --no-interaction
|
|
- name: Run unittests (redismod:${{ matrix.redismod }}, ${{ matrix.os }})
|
|
run: |
|
|
make test
|
|
poetry run coverage xml
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v2.1.0
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: unit
|
|
env_vars: OS
|
|
fail_ci_if_error: false
|
|
|
|
deploy:
|
|
name: Deploy
|
|
runs-on: ubuntu-latest
|
|
needs: test-unix
|
|
# Run only on pushing a tag
|
|
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2.3.5
|
|
- name: Setup Python 3.9
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
- name: Install dependencies
|
|
run:
|
|
python -m pip install -U pip wheel twine
|
|
- name: Make dists
|
|
run:
|
|
python setup.py sdist bdist_wheel
|
|
- name: PyPI upload
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
run: |
|
|
twine upload dist/*
|