diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 5342238dd3..ef24d75a12 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -56,19 +56,18 @@ jobs: pip install -r dev_requirements.txt invoke linters - resp2-tests: + 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'] - test-type: ['standalone', 'cluster'] + 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: RESP2 ${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} + name: Standalone-${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} steps: - uses: actions/checkout@v4 @@ -77,7 +76,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pip' - - name: Run tests + - name: Build infrastructure run: | pip install -U setuptools wheel pip install -r requirements.txt @@ -85,17 +84,27 @@ jobs: if [ "${{matrix.connection-type}}" == "hiredis" ]; then pip install hiredis fi + mkdir coverage invoke devenv sleep 10 # time to settle - invoke ${{matrix.test-type}}-tests + + - 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-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}} + name: pytest-results-standalone-${{matrix.connection-type}}-${{matrix.python-version}} path: | - ${{matrix.test-type}}*-results.xml + coverage/* prof/** profile_output* if-no-files-found: error @@ -106,21 +115,18 @@ jobs: with: fail_ci_if_error: false - resp3-tests: + cluster: runs-on: ubuntu-latest + timeout-minutes: 60 strategy: + max-parallel: 15 fail-fast: false matrix: - python-version: ['3.8', '3.12'] - test-type: ['standalone', 'cluster'] + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9' ] connection-type: ['hiredis', 'plain'] - event-loop: ['asyncio', 'uvloop'] - exclude: - - test-type: 'cluster' - connection-type: 'hiredis' env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - name: RESP3 ${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.event-loop}} + name: Cluster-${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} steps: - uses: actions/checkout@v4 @@ -129,28 +135,35 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pip' - - name: Run tests + - 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 + pip install hiredis fi - invoke devenv + mkdir coverage + invoke devenv-cluster sleep 10 # time to settle - if [ "${{matrix.event-loop}}" == "uvloop" ]; then - invoke ${{matrix.test-type}}-tests --uvloop --protocol=3 - else - invoke ${{matrix.test-type}}-tests --protocol=3 - fi + + - 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-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}-${{matrix.event-loop}}-resp3 + name: pytest-results-cluster-${{matrix.connection-type}}-${{matrix.python-version}} path: | - ${{matrix.test-type}}*-results.xml + coverage/* prof/** profile_output* if-no-files-found: error @@ -164,7 +177,7 @@ jobs: build-and-test-package: name: Validate building and installing the package runs-on: ubuntu-latest - needs: [resp2-tests, resp3-tests] + needs: [standalone, cluster] strategy: fail-fast: false matrix: diff --git a/tasks.py b/tasks.py index 76737b8eff..cb3a4b690a 100644 --- a/tasks.py +++ b/tasks.py @@ -11,9 +11,16 @@ @task def devenv(c): - """Brings up the test environment, by wrapping docker compose.""" + """Brings up the test environment for standalone redis, by wrapping docker compose.""" clean(c) - cmd = "docker compose --profile all up -d --build" + cmd = "docker compose --profile standalone --profile replica --profile sentinel up -d --build" + run(cmd) + +@task +def devenv_cluster(c): + """Brings up the test environment for OSS cluster redis, by wrapping docker compose.""" + clean(c) + cmd = "docker compose --profile cluster --profile standalone up -d --build" run(cmd) @@ -55,11 +62,11 @@ def standalone_tests(c, uvloop=False, protocol=2, profile=False): profile_arg = "--profile" if profile else "" if uvloop: run( - f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -m 'not onlycluster' --uvloop --junit-xml=standalone-uvloop-results.xml" + f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -m 'not onlycluster' --uvloop --junit-xml=coverage/standalone-uvloop-results.xml" ) else: run( - f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -m 'not onlycluster' --junit-xml=standalone-results.xml" + f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -m 'not onlycluster' --junit-xml=coverage/standalone-results.xml" ) @@ -70,11 +77,11 @@ def cluster_tests(c, uvloop=False, protocol=2, profile=False): cluster_url = "redis://localhost:16379/0" if uvloop: run( - f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_cluster.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --junit-xml=cluster-uvloop-results.xml --uvloop" + f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_cluster.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --junit-xml=coverage/cluster-uvloop-results.xml --uvloop" ) else: run( - f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_clusteclient.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --junit-xml=cluster-results.xml" + f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_clusteclient.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --junit-xml=coverage/cluster-results.xml" )