Changed test infrastructure to run separate cluster and standalone tests #5160
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: CI | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
- '**/*.rst' | |
- '**/*.md' | |
branches: | |
- master | |
- '[0-9].[0-9]' | |
pull_request: | |
branches: | |
- master | |
- '[0-9].[0-9]' | |
schedule: | |
- cron: '0 1 * * *' # nightly build | |
concurrency: | |
group: ${{ github.event.pull_request.number || github.ref }}-integration | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665 | |
COVERAGE_CORE: sysmon | |
REDIS_IMAGE: redis:7.4-rc2 | |
REDIS_STACK_IMAGE: redis/redis-stack-server:latest | |
jobs: | |
dependency-audit: | |
name: Dependency audit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pypa/gh-action-pip-audit@v1.0.8 | |
with: | |
inputs: requirements.txt dev_requirements.txt | |
ignore-vulns: | | |
GHSA-w596-4wvx-j9j6 # subversion related git pull, dependency for pytest. There is no impact here. | |
lint: | |
name: Code linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
cache: 'pip' | |
- name: run code linters | |
run: | | |
pip install -r dev_requirements.txt | |
invoke linters | |
standalone: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
max-parallel: 15 | |
fail-fast: false | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9' ] | |
connection-type: ['hiredis', 'plain'] | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
name: Standalone-${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Build infrastructure | |
run: | | |
pip install -U setuptools wheel | |
pip install -r requirements.txt | |
pip install -r dev_requirements.txt | |
if [ "${{matrix.connection-type}}" == "hiredis" ]; then | |
pip install hiredis | |
fi | |
mkdir coverage | |
invoke devenv | |
sleep 10 # time to settle | |
- name: Run RESP2 tests | |
run: | | |
invoke standalone-tests | |
ls -1 | |
- name: Run RESP3 tests | |
if: ${{matrix.python-version == '3.8' || matrix.python-version == '3.12'}} | |
run: | | |
invoke standalone-tests --uvloop --protocol=3 | |
invoke standalone-tests --protocol=3 | |
- name: Upload test results and profiling data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-standalone-${{matrix.connection-type}}-${{matrix.python-version}} | |
path: | | |
coverage/* | |
prof/** | |
profile_output* | |
if-no-files-found: error | |
retention-days: 10 | |
- name: Upload codecov coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
cluster: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
max-parallel: 15 | |
fail-fast: false | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9' ] | |
connection-type: ['hiredis', 'plain'] | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
name: Cluster-${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Build infrastructure | |
run: | | |
pip install -U setuptools wheel | |
pip install -r requirements.txt | |
pip install -r dev_requirements.txt | |
if [ "${{matrix.connection-type}}" == "hiredis" ]; then | |
pip install hiredis | |
fi | |
mkdir coverage | |
invoke devenv-cluster | |
sleep 10 # time to settle | |
- name: Run RESP2 tests | |
run: | | |
invoke cluster-tests | |
ls -1 | |
- name: Run RESP3 tests | |
if: ${{matrix.python-version == '3.8' || matrix.python-version == '3.12'}} | |
run: | | |
invoke cluster-tests --uvloop --protocol=3 | |
invoke cluster-tests --protocol=3 | |
- name: Upload test results and profiling data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-cluster-${{matrix.connection-type}}-${{matrix.python-version}} | |
path: | | |
coverage/* | |
prof/** | |
profile_output* | |
if-no-files-found: error | |
retention-days: 10 | |
- name: Upload codecov coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
build-and-test-package: | |
name: Validate building and installing the package | |
runs-on: ubuntu-latest | |
needs: [standalone, cluster] | |
strategy: | |
fail-fast: false | |
matrix: | |
extension: ['tar.gz', 'whl'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Run installed unit tests | |
run: | | |
bash .github/workflows/install_and_test.sh ${{ matrix.extension }} | |
install-package-from-commit: | |
name: Install package from commit hash | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: install from pip | |
run: | | |
pip install --quiet git+${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git@${GITHUB_SHA} |