Skip to content

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

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

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

# 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 Etcd
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "core/src/**"
- "core/tests/**"
- "!core/src/docs/**"
- "!core/src/services/**"
- "core/src/services/etcd/**"
- ".github/workflows/service_test_etcd.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
etcd:
runs-on: ubuntu-latest
services:
etcd:
image: bitnami/etcd:latest
ports:
- "2379:2379"
- "2380:2380"
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_NAME: etcd
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://etcd:2379
ETCD_MAX_REQUEST_BYTES: 10485760
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-protoc: true
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run etcd --features services-etcd
env:
OPENDAL_ETCD_TEST: on
OPENDAL_ETCD_ENDPOINTS: http://127.0.0.1:2379
OPENDAL_ETCD_ROOT: /tmp/opendal
etcd-cluster:
runs-on: ubuntu-latest
services:
etcd1:
image: bitnami/etcd:latest
ports:
- "23790:2379"
- "23800:2380"
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_NAME: etcd1
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd1:2380
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://etcd1:2379
ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster
ETCD_INITIAL_CLUSTER: etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_MAX_REQUEST_BYTES: 10485760
etcd2:
image: bitnami/etcd:latest
ports:
- "23791:2379"
- "23801:2380"
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_NAME: etcd2
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd2:2380
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://etcd2:2379
ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster
ETCD_INITIAL_CLUSTER: etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_MAX_REQUEST_BYTES: 10485760
etcd3:
image: bitnami/etcd:latest
ports:
- "23792:2379"
- "23802:2380"
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_NAME: etcd3
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd3:2380
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://etcd3:2379
ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster
ETCD_INITIAL_CLUSTER: etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_MAX_REQUEST_BYTES: 10485760
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-protoc: true
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run etcd --features services-etcd
env:
OPENDAL_ETCD_TEST: on
OPENDAL_ETCD_ENDPOINTS: http://127.0.0.1:23790,http://127.0.0.1:23791,http://127.0.0.1:23792
OPENDAL_ETCD_ROOT: /tmp/opendal
etcd-cluster-tls:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Copy Etcd Certificate Files
shell: bash
working-directory: core
run: |
mkdir -p /tmp/etcd
cp -r `pwd`/src/services/etcd/fixtures/* /tmp/etcd
- name: Configure Etcd Service With TLS
# ETCD will use ports: 23790,23791,23792,23800,23801,23802
run: |
# Create docker network
docker network create -d bridge --subnet=176.16.12.0/24 --gateway=176.16.12.1 etcd-tls-net
# Launch etcd
for no in `seq 0 2`; do \
num=$((no+1))
ip=$((no+2))
docker run -d \
-p 2379${no}:2379 \
-p 2380${no}:2380 \
--network etcd-tls-net \
--name etcd-tls-${num} \
--ip 176.16.12.${ip} \
-v /tmp/etcd/ca.pem:/opt/bitnami/etcd/conf/ca.pem \
-v /tmp/etcd/server.pem:/opt/bitnami/etcd/conf/server.pem \
-v /tmp/etcd/server-key.pem:/opt/bitnami/etcd/conf/server-key.pem \
-v /tmp/etcd/client-key.pem:/opt/bitnami/etcd/client-key.pem \
-v /tmp/etcd/client.pem:/opt/bitnami/etcd/client.pem \
-v /tmp/etcd/etcd${num}/etcd.pem:/opt/bitnami/etcd/conf/peer.pem \
-v /tmp/etcd/etcd${num}/etcd-key.pem:/opt/bitnami/etcd/conf/peer-key.pem \
-e ETCD_ROOT_PASSWORD=opendal \
-e ETCD_CLIENT_CERT_AUTH=true \
-e ETCD_PEER_CLIENT_CERT_AUTH=true \
-e ETCD_NAME=etcd${num} \
-e ETCD_INITIAL_ADVERTISE_PEER_URLS=https://176.16.12.${ip}:2380 \
-e ETCD_LISTEN_PEER_URLS=https://0.0.0.0:2380 \
-e ETCD_LISTEN_CLIENT_URLS=https://0.0.0.0:2379 \
-e ETCD_ADVERTISE_CLIENT_URLS=https://176.16.12.${ip}:2379 \
-e ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster \
-e ETCD_INITIAL_CLUSTER=etcd1=https://176.16.12.2:2380,etcd2=https://176.16.12.3:2380,etcd3=https://176.16.12.4:2380 \
-e ETCD_INITIAL_CLUSTER_STATE=new \
-e ETCD_MAX_REQUEST_BYTES=10485760 \
-e ETCD_TRUSTED_CA_FILE=/opt/bitnami/etcd/conf/ca.pem \
-e ETCD_KEY_FILE=/opt/bitnami/etcd/conf/server-key.pem \
-e ETCD_CERT_FILE=/opt/bitnami/etcd/conf/server.pem \
-e ETCD_PEER_TRUSTED_CA_FILE=/opt/bitnami/etcd/conf/ca.pem \
-e ETCD_PEER_KEY_FILE=/opt/bitnami/etcd/conf/peer-key.pem \
-e ETCD_PEER_CERT_FILE=/opt/bitnami/etcd/conf/peer.pem \
bitnami/etcd:latest
done
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-protoc: true
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run etcd --features services-etcd
env:
OPENDAL_ETCD_TEST: on
OPENDAL_ETCD_ENDPOINTS: https://127.0.0.1:23790,https://127.0.0.1:23791,https://127.0.0.1:23792
OPENDAL_ETCD_ROOT: /tmp/opendal
OPENDAL_ETCD_USERNAME: root
OPENDAL_ETCD_PASSWORD: opendal
OPENDAL_ETCD_CA_PATH: /tmp/etcd/ca.pem
OPENDAL_ETCD_CERT_PATH: /tmp/etcd/client.pem
OPENDAL_ETCD_KEY_PATH: /tmp/etcd/client-key.pem