Skip to content

ci: use cache to speed up haskell ci (#2792) #2743

ci: use cache to speed up haskell ci (#2792)

ci: use cache to speed up haskell ci (#2792) #2743

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Service Test Redis
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "core/src/**"
- "core/tests/**"
- "!core/src/docs/**"
- "!core/src/services/**"
- "core/src/services/redis/**"
- ".github/workflows/service_test_redis.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
redis:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run redis --features services-redis
env:
OPENDAL_REDIS_TEST: on
OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379
OPENDAL_REDIS_ROOT: /
OPENDAL_REDIS_DB: 0
redis-tls:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure Redis with TLS
run: |
mkdir ssl
# Create CA
openssl req \
-x509 -new -nodes \
-keyout ssl/ca.key \
-sha256 \
-days 365 \
-out ssl/ca.crt \
-subj '/CN=Test Root CA/C=US/ST=Test/L=Test/O=Opendal'
# Create redis certificate
openssl req \
-new -nodes \
-out ssl/redis.csr \
-keyout ssl/redis.key \
-subj '/CN=Redis certificate/C=US/ST=Test/L=Test/O=Opendal'
cat > ssl/redis.v3.ext << EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
IP.1 = 127.0.0.1
EOF
openssl x509 \
-req \
-in ssl/redis.csr \
-CA ssl/ca.crt \
-CAkey ssl/ca.key \
-CAcreateserial \
-out ssl/redis.crt \
-days 300 \
-sha256 \
-extfile ssl/redis.v3.ext
chmod 777 ssl/redis.crt ssl/redis.key # allow the redis docker to read these files
# Launch redis
docker run -d \
--rm \
--name redis \
--network host \
--mount type=bind,source=$PWD/ssl,target=/etc/redis/ssl \
redis \
--tls-port 6380 \
--tls-cert-file /etc/redis/ssl/redis.crt \
--tls-key-file /etc/redis/ssl/redis.key \
--tls-auth-clients no
# Install the CA in the system
sudo cp ssl/ca.crt /usr/local/share/ca-certificates
sudo update-ca-certificates
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run redis --features services-redis-rustls
env:
OPENDAL_REDIS_TEST: on
OPENDAL_REDIS_ENDPOINT: rediss://localhost:6380
OPENDAL_REDIS_ROOT: /
OPENDAL_REDIS_DB: 0
dragonfly:
runs-on: ubuntu-latest
services:
redis:
image: docker.dragonflydb.io/dragonflydb/dragonfly
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run redis --features services-redis
env:
OPENDAL_REDIS_TEST: on
OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379
OPENDAL_REDIS_ROOT: /
OPENDAL_REDIS_DB: 0
kvrocks:
runs-on: ubuntu-latest
services:
redis:
image: apache/kvrocks
ports:
- 6379:6666
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run redis --features services-redis
env:
OPENDAL_REDIS_TEST: on
OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379
OPENDAL_REDIS_ROOT: /
OPENDAL_REDIS_DB: 0