2021-10-21 02:13:42 +02:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-10-21 02:16:43 +02:00
|
|
|
- main
|
2021-10-21 02:13:42 +02:00
|
|
|
- '[0-9].[0-9]+' # matches to backport branches, e.g. 3.6
|
|
|
|
tags: [ 'v*' ]
|
|
|
|
pull_request:
|
|
|
|
branches:
|
2021-10-21 02:16:43 +02:00
|
|
|
- main
|
2021-10-21 02:13:42 +02:00
|
|
|
- '[0-9].[0-9]+'
|
|
|
|
- 'update/pre-commit-autoupdate'
|
|
|
|
schedule:
|
2021-11-03 01:08:32 +01:00
|
|
|
- cron: '0 6 * * *' # Daily 6AM UTC build
|
2021-10-21 02:13:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
lint:
|
|
|
|
name: Linter
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
2021-11-03 01:08:32 +01:00
|
|
|
- name: Checkout
|
2022-03-02 04:31:19 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-11-03 01:08:32 +01:00
|
|
|
- name: Setup Python 3.9
|
2022-08-09 13:39:49 +02:00
|
|
|
uses: actions/setup-python@v4.2.0
|
2021-11-03 01:08:32 +01:00
|
|
|
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
|
2022-03-22 04:24:12 +01:00
|
|
|
uses: actions/cache@v3
|
2021-11-03 01:08:32 +01:00
|
|
|
with:
|
|
|
|
path: .venv
|
|
|
|
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
2021-11-10 21:20:51 +01:00
|
|
|
- name: Make sync version of library (redis_om)
|
|
|
|
run: make sync
|
2021-11-03 01:08:32 +01:00
|
|
|
#----------------------------------------------
|
|
|
|
# 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 dist
|
|
|
|
make lint
|
2021-10-21 02:13:42 +02:00
|
|
|
|
|
|
|
test-unix:
|
|
|
|
name: Test Unix
|
|
|
|
needs: lint
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-11-03 01:08:32 +01:00
|
|
|
os: [ ubuntu-latest ]
|
2022-07-11 09:58:45 +02:00
|
|
|
pyver: [ "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-3.8", "pypy-3.7" ]
|
2022-03-30 10:54:05 +02:00
|
|
|
redisstack: [ "latest" ]
|
2021-10-21 02:13:42 +02:00
|
|
|
fail-fast: false
|
|
|
|
services:
|
|
|
|
redis:
|
2022-03-30 10:54:05 +02:00
|
|
|
image: redis/redis-stack:${{ matrix.redisstack }}
|
2021-10-21 02:13:42 +02:00
|
|
|
ports:
|
2021-10-21 02:21:33 +02:00
|
|
|
# Maps port 6379 on service container to the host
|
|
|
|
- 6379:6379
|
2021-10-21 02:13:42 +02:00
|
|
|
# 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:
|
2021-11-03 01:08:32 +01:00
|
|
|
- name: Checkout
|
2022-03-02 04:31:19 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-11-03 01:08:32 +01:00
|
|
|
- name: Setup Python ${{ matrix.pyver }}
|
2022-08-09 13:39:49 +02:00
|
|
|
uses: actions/setup-python@v4.2.0
|
2021-11-03 01:08:32 +01:00
|
|
|
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
|
2022-03-22 04:24:12 +01:00
|
|
|
uses: actions/cache@v3
|
2021-11-03 01:08:32 +01:00
|
|
|
with:
|
|
|
|
path: .venv
|
|
|
|
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
|
|
|
#----------------------------------------------
|
2021-11-10 21:20:51 +01:00
|
|
|
# Make sync version of library (redis_om)
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Make sync version of library (redis_om)
|
|
|
|
run: make sync
|
|
|
|
#----------------------------------------------
|
2021-11-03 01:08:32 +01:00
|
|
|
# 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
|
2022-03-30 10:54:05 +02:00
|
|
|
- name: Run unittests (redisstack:${{ matrix.redisstack }}, ${{ matrix.os }})
|
2021-11-12 18:43:49 +01:00
|
|
|
env:
|
|
|
|
REDIS_OM_URL: "redis://localhost:6379?decode_responses=True"
|
2021-11-03 01:08:32 +01:00
|
|
|
run: |
|
|
|
|
make test
|
|
|
|
poetry run coverage xml
|
|
|
|
- name: Upload coverage
|
2022-04-06 05:20:59 +02:00
|
|
|
uses: codecov/codecov-action@v3
|
2021-11-03 01:08:32 +01:00
|
|
|
with:
|
|
|
|
file: ./coverage.xml
|
|
|
|
flags: unit
|
|
|
|
env_vars: OS
|
|
|
|
fail_ci_if_error: false
|
2021-10-21 02:13:42 +02:00
|
|
|
|
|
|
|
deploy:
|
2021-11-03 01:08:32 +01:00
|
|
|
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
|
2022-03-02 04:31:19 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-11-03 01:08:32 +01:00
|
|
|
- name: Setup Python 3.9
|
2022-08-09 13:39:49 +02:00
|
|
|
uses: actions/setup-python@v4.2.0
|
2021-11-03 01:08:32 +01:00
|
|
|
with:
|
|
|
|
python-version: 3.9
|
|
|
|
- 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
|
2022-03-22 04:24:12 +01:00
|
|
|
uses: actions/cache@v3
|
2021-11-03 01:08:32 +01:00
|
|
|
with:
|
|
|
|
path: .venv
|
|
|
|
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
|
|
|
#----------------------------------------------
|
2021-11-10 21:20:51 +01:00
|
|
|
# Make sync version of library (redis_om)
|
|
|
|
#----------------------------------------------
|
|
|
|
- name: Make sync version of library (redis_om)
|
|
|
|
run: make sync
|
|
|
|
#----------------------------------------------
|
2021-11-03 01:08:32 +01:00
|
|
|
# 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: PyPI upload
|
|
|
|
env:
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
|
|
run: |
|
|
|
|
make upload
|