-
Notifications
You must be signed in to change notification settings - Fork 2
152 lines (129 loc) · 4.73 KB
/
func-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Func-tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '30 06 * * *'
env:
GO_VERSION: 1.21.6
DOCKER_API_VERSION: 1.43
jobs:
prepare:
name: Prepare
runs-on: ubuntu-22.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Patched redis cache
id: patched-redis-cache
uses: actions/cache@v4
with:
path: |
redis/src/redis-server
redis/src/redis-senticache
redis/src/redis-cli
key: rdsync-redis-${{ hashFiles('redis_patches/*') }}
- name: Build patched redis
if: steps.patched-redis-cache.outputs.cache-hit != 'true'
run: make redis/src/redis-server
- name: Zookeeper cache
id: zookeeper-cache
uses: actions/cache@v4
with:
path: tests/images/zookeeper/zookeeper.tar.gz
key: rdsync-zookeeper-${{ hashFiles('tests/images/zookeeper/zookeeper.tar.gz') }}-${{ hashFiles('Makefile') }}
- name: Download zookeeper binary
if: steps.zookeeper-cache.outputs.cache-hit != 'true'
run: make tests/images/zookeeper/zookeeper.tar.gz
- name: Base image cache
id: cache-base-image
uses: actions/cache@v4
with:
path: ~/rdsync-base-img.tgz
key: rdsync-base-img-${{ hashFiles('tests/images/base/*') }}
- name: Build base image
if: steps.cache-base-image.outputs.cache-hit != 'true'
run: make base_image
- name: Export base image
if: steps.cache-base-image.outputs.cache-hit != 'true'
run: docker save rdsync-base | gzip -c > ~/rdsync-base-img.tgz
test:
name: Test
runs-on: ubuntu-22.04
needs: [ prepare ]
strategy:
matrix:
command:
- 'GODOG_FEATURE=00_cluster_smoke make test'
- 'GODOG_FEATURE=00_sentinel_smoke make test'
- 'GODOG_FEATURE=01_cluster_maintenance make test'
- 'GODOG_FEATURE=01_sentinel_maintenance make test'
- 'GODOG_FEATURE=02_cluster_switchover_from make test'
- 'GODOG_FEATURE=02_sentinel_switchover_from make test'
- 'GODOG_FEATURE=03_cluster_switchover_to make test'
- 'GODOG_FEATURE=03_sentinel_switchover_to make test'
- 'GODOG_FEATURE=04_cluster_failover make test'
- 'GODOG_FEATURE=04_sentinel_failover make test'
- 'GODOG_FEATURE=05_cluster_replication_fix make test'
- 'GODOG_FEATURE=05_sentinel_replication_fix make test'
- 'GODOG_FEATURE=06_cluster_lost make test'
- 'GODOG_FEATURE=06_sentinel_lost make test'
- 'GODOG_FEATURE=07_cluster_local_repair make test'
- 'GODOG_FEATURE=07_sentinel_local_repair make test'
fail-fast: false
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: go get -v -t -d ./...
- name: Load patched redis
id: patched-redis-cache
uses: actions/cache@v4
with:
path: |
redis/src/redis-server
redis/src/redis-senticache
redis/src/redis-cli
key: rdsync-redis-${{ hashFiles('redis_patches/*') }}
- name: Fail if no cached patched redis
if: steps.patched-redis-cache.outputs.cache-hit != 'true'
run: |
echo "Failed to fetch cached patched redis. Will now exit..."
exit 1
- name: Load zookeeper
id: zookeeper-cache
uses: actions/cache@v4
with:
path: tests/images/zookeeper/zookeeper.tar.gz
key: rdsync-zookeeper-${{ hashFiles('tests/images/zookeeper/zookeeper.tar.gz') }}-${{ hashFiles('Makefile') }}
- name: Fail if no cached zookeeper
if: steps.zookeeper-cache.outputs.cache-hit != 'true'
run: |
echo "Failed to fetch cached zookeeper. Will now exit..."
exit 1
- name: Load docker images
id: cache-base-image
uses: actions/cache@v4
with:
path: ~/rdsync-base-img.tgz
key: rdsync-base-img-${{ hashFiles('tests/images/base/*') }}
- name: Fail if no cached base image
if: steps.cache-base-image.outputs.cache-hit != 'true'
run: |
echo "Failed to fetch cached base image. Will now exit..."
exit 1
- name: Import image
run: docker load -i ~/rdsync-base-img.tgz
- name: Run test
run: ${{ matrix.command }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: logs
path: tests/logs