Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update integration.yaml #170

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 115 additions & 113 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,120 +21,122 @@ concurrency:
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)
contents: read # to fetch code (actions/checkout)

jobs:

dependency-audit:
name: Dependency audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pypa/[email protected]
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

populate-cache:
runs-on: ubuntu-latest
timeout-minutes: 60
name: Update docker cache
steps:
- uses: actions/checkout@v4
- name: Cache docker images
id: custom-cache
uses: actions/cache@v4
with:
path: ./custom-cache/
key: custom-cache
- if: ${{ steps.custom-cache.outputs.cache-hit != 'true' || github.event_name == 'schedule' }}
name: Update Cache
run: |
mkdir -p ./custom-cache/
docker compose --profile all build
docker pull valkey/valkey:latest
docker save valkey-py-stunnel:latest valkey-py-cluster:latest valkey/valkey:latest -o ./custom-cache/all.tar

run-tests:
runs-on: ubuntu-latest
needs: [populate-cache]
timeout-minutes: 60
strategy:
max-parallel: 15
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.11.1', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
test-type: ['standalone', 'cluster']
connection-type: ['libvalkey', 'plain']
protocol-version: ['2','3']
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
name: Python ${{ matrix.python-version }} RESP${{ matrix.protocol-version }} ${{matrix.test-type}}-${{matrix.connection-type}} tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Cache docker images
id: custom-cache
uses: actions/cache@v4
with:
path: ./custom-cache/
fail-on-cache-miss: true
key: custom-cache
- name: Use Cache
run: docker image load -i ./custom-cache/all.tar

- name: run tests
run: |
pip install -U setuptools wheel
pip install -r requirements.txt
pip install -r dev_requirements.txt
if [ "${{matrix.connection-type}}" == "libvalkey" ]; then
pip install "libvalkey>=4.0.1"
fi
invoke devenv
if [[ "${{matrix.test-type}}" == "standalone" ]]; then
./util/wait-for-it.sh localhost:6379
else
./util/wait-for-it.sh localhost:16379
fi
invoke ${{matrix.test-type}}-tests --protocol=${{ matrix.protocol-version }}
if [[ "${{matrix.python-version}}" != pypy-* ]]; then
invoke ${{matrix.test-type}}-tests --uvloop --protocol=${{ matrix.protocol-version }}
fi

- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}-RESP${{ matrix.protocol-version }}
path: '${{matrix.test-type}}*results.xml'

- name: Upload codecov coverage
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}


build_and_test_package:
dependency-audit:
name: Dependency audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pypa/[email protected]
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

populate-cache:
runs-on: ubuntu-latest
timeout-minutes: 60
name: Update docker cache
steps:
- uses: actions/checkout@v4
- name: Set timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Cache docker images
id: custom-cache
uses: actions/cache@v4
with:
path: ./custom-cache/
key: custom-cache-${{ github.sha }}-{{ runner.os }}-${{ github.event_name }}-${{ steps.timestamp.outputs.timestamp }}
- if: ${{ steps.custom-cache.outputs.cache-hit != 'true' || github.event_name == 'schedule' }}
name: Update Cache
run: |
mkdir -p ./custom-cache/
docker compose --profile all build --no-cache
docker pull valkey/valkey:latest
docker save valkey-py-stunnel:latest valkey-py-cluster:latest valkey/valkey:latest -o ./custom-cache/all.tar

run-tests:
runs-on: ubuntu-latest
needs: [populate-cache]
timeout-minutes: 60
strategy:
max-parallel: 15
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.11.1', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
test-type: ['standalone', 'cluster']
connection-type: ['libvalkey', 'plain']
protocol-version: ['2','3']
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
name: Python ${{ matrix.python-version }} RESP${{ matrix.protocol-version }} ${{matrix.test-type}}-${{matrix.connection-type}} tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Cache docker images
id: custom-cache
uses: actions/cache@v4
with:
path: ./custom-cache/
fail-on-cache-miss: true
key: custom-cache-${{ github.sha }}-{{ runner.os }}-${{ github.event_name }}-${{ steps.timestamp.outputs.timestamp }}
- name: Use Cache
run: docker image load -i ./custom-cache/all.tar

- name: run tests
run: |
pip install -U setuptools wheel
pip install -r requirements.txt
pip install -r dev_requirements.txt
if [ "${{matrix.connection-type}}" == "libvalkey" ]; then
pip install "libvalkey>=4.0.1"
fi
invoke devenv
if [[ "${{matrix.test-type}}" == "standalone" ]]; then
./util/wait-for-it.sh localhost:6379
else
./util/wait-for-it.sh localhost:16379
fi
invoke ${{matrix.test-type}}-tests --protocol=${{ matrix.protocol-version }}
if [[ "${{matrix.python-version}}" != pypy-* ]]; then
invoke ${{matrix.test-type}}-tests --uvloop --protocol=${{ matrix.protocol-version }}
fi

- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}-RESP${{ matrix.protocol-version }}
path: '${{matrix.test-type}}*results.xml'

- name: Upload codecov coverage
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

build_and_test_package:
name: Validate building and installing the package
runs-on: ubuntu-latest
needs: [run-tests]
Expand All @@ -154,15 +156,15 @@ jobs:
with:
path: ./custom-cache/
fail-on-cache-miss: true
key: custom-cache
key: custom-cache-${{ github.sha }}-{{ runner.os }}-${{ github.event_name }}-${{ steps.timestamp.outputs.timestamp }}
- name: Use Cache
run: docker image load -i ./custom-cache/all.tar

- name: Run installed unit tests
run: |
bash .github/workflows/install_and_test.sh ${{ matrix.extension }}

install_package_from_commit:
install_package_from_commit:
name: Install package from commit hash
runs-on: ubuntu-latest
strategy:
Expand Down