1
1
name : Unstable
2
2
3
3
on :
4
- # TBD when this workflow should run
5
- pull_request :
6
- workflow_dispatch :
7
- # schedule:
8
- # - cron: '0 0 * * *'
4
+ pull_request :
5
+ paths :
6
+ - ' snap/**'
7
+ - ' .github/workflows/**'
9
8
10
9
jobs :
11
10
build :
12
- runs-on : ubuntu-22.04
13
- # Next line is in comment for testing with forked repository
14
- # if: github.repository == 'redis/redis-snap'
15
- strategy :
16
- matrix :
17
- target-arch : [amd64, arm64]
11
+ strategy :
12
+ fail-fast : false
13
+ matrix :
14
+ include :
15
+ - architecture : amd64
16
+ runner : ubuntu-22.04
17
+ - architecture : arm64
18
+ runner : hosted-ubuntu-2204-arm64-mini
19
+
20
+ runs-on : ${{ matrix.runner }}
21
+
18
22
steps :
19
23
- uses : actions/checkout@v4
20
24
- uses : actions/checkout@v4
21
25
with :
22
26
repository : redis/redis
23
27
path : redis
24
- - name : Prepare for cross-compilation
25
- run : |
26
- sudo dpkg --add-architecture arm64
27
- sudo sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list
28
- cat <<_END_ | sudo tee /etc/apt/sources.list.d/crosscompile.list
29
- deb [arch=arm64] http://ports.ubuntu.com $(lsb_release -cs) main universe
30
- deb [arch=arm64] http://ports.ubuntu.com $(lsb_release -cs)-updates main universe
31
- _END_
28
+ ref : ' 8.0-m02'
29
+
32
30
- name : Setup Snapcraft
33
31
run : |
34
32
sudo snap install snapcraft --classic
33
+
35
34
- name : Build Snap
36
35
env :
37
36
SNAPCRAFT_BUILD_ENVIRONMENT : host
38
37
SNAPCRAFT_BUILD_INFO : 1
39
38
run : |
40
- echo "the architecture is ${{ matrix.target-arch }}"
41
- sudo snapcraft --verbose --target-arch ${{ matrix.target-arch }} --destructive-mode --enable-experimental-target-arch
42
- # continue-on-error: true #Consider removing this line after finishing testing
43
-
44
- - name : Archive Snapcraft logs on failure
45
- # Can be removed when pushing to the real repository
46
- if : failure() # This step runs only if a previous step fails
47
- run : |
48
- LOG_DIR="${HOME}/.local/state/snapcraft"
49
- echo "Searching for logs in $LOG_DIR..."
50
- ls -R $LOG_DIR || echo "No logs found."
51
- continue-on-error : true # Ensure this step does not block execution
52
-
53
- - name : Upload Snapcraft logs as artifact
54
- # Can be removed when pushing to the real repository
55
- if : failure() # Runs only on failure
56
- uses : actions/upload-artifact@v4
57
- with :
58
- name : snapcraft-logs
59
- path : ~/.local/state/snapcraft/log
60
-
39
+ sudo snapcraft --destructive-mode
40
+
61
41
- name : Upload
42
+ if : github.repository == 'redis/redis-snap'
62
43
run : |
63
- echo "placeholder for snap package upload"
64
- # for f in *.snap; do snapcraft upload --release=edge $f; done
44
+ echo "placeholder for snap package upload"
45
+ for f in *.snap; do snapcraft upload --release=edge $f; done
65
46
env :
66
47
SNAPCRAFT_STORE_CREDENTIALS : ${{secrets.SNAP_TOKEN}}
67
- - name : upload to artifacts
68
- # Can be removed when pushing to the real repository
48
+
49
+ - name : Upload to artifacts
69
50
uses : actions/upload-artifact@v4
70
51
with :
71
- name : redis-snap-${{ matrix.target-arch }}
52
+ name : redis-snap-${{ matrix.architecture }}-${{ github.sha }}
72
53
path : |
73
- *.snap
74
-
75
- test :
76
- # This step is for basic testing of the snap package and is a placeholder for more comprehensive testing (e.g. using smoke tests)
77
- needs : build
78
- runs-on : ${{ matrix.arch == 'arm64' && 'ubuntu24-arm64-4-16' || 'ubuntu-latest' }} # Not sure what version of Ubuntu should be used for testing
79
- strategy :
80
- matrix :
81
- target-arch : [ amd64, arm64 ]
82
- steps :
83
- - name : Download artifact
84
- uses : actions/download-artifact@v4
85
- with :
86
- name : redis-snap-${{ matrix.target-arch }}
87
- path : ./snap-artifacts
88
- - name : Install the snap package
89
- run : |
90
- SNAP_FILE=$(ls snap-artifacts/*.snap)
91
- echo "Installing snap: $SNAP_FILE"
92
- sudo snap install --dangerous $SNAP_FILE
93
- - name : Verify snap installation
94
- run : |
95
- snap list | grep redis
96
- snap services | grep redis || echo "Redis service not found."
97
- - name : Check Redis snap status
98
- run : |
99
- snap info redis
54
+ *.snap
55
+ retention-days : 1
56
+
57
+ test :
58
+ needs : build
59
+ strategy :
60
+ fail-fast : false
61
+ matrix :
62
+ include :
63
+ # AMD64 runners
64
+ - architecture : amd64
65
+ os : ubuntu-20.04
66
+ runner : ubuntu-20.04
67
+ - architecture : amd64
68
+ os : ubuntu-22.04
69
+ runner : ubuntu-22.04
70
+ - architecture : amd64
71
+ os : ubuntu-24.04
72
+ runner : ubuntu-24.04
73
+
74
+ # ARM64 runners
75
+ - architecture : arm64
76
+ os : ubuntu-22.04
77
+ runner : hosted-ubuntu-2204-arm64-mini
78
+ - architecture : arm64
79
+ os : ubuntu-24.04
80
+ runner : ubuntu24-arm64-2-8
81
+
82
+ runs-on : ${{ matrix.runner }}
83
+
84
+ steps :
85
+ - name : Setup test environment
86
+ run : |
87
+ echo "Testing on ${{ matrix.os }} for ${{ matrix.architecture }}"
88
+ echo "System information:"
89
+ uname -a
90
+ lsb_release -a
91
+
92
+ - name : Download artifact
93
+ uses : actions/download-artifact@v4
94
+ with :
95
+ name : redis-snap-${{ matrix.architecture }}-${{ github.sha }}
96
+ path : ./snap-artifacts
97
+
98
+ - name : Verify artifacts
99
+ run : |
100
+ ls -la ./snap-artifacts
101
+ echo "Found snap files:"
102
+ find ./snap-artifacts -name "*.snap"
103
+
104
+ - name : Install Redis snap package
105
+ run : |
106
+ SNAP_FILE=$(ls snap-artifacts/*.snap)
107
+ echo "Installing snap: $SNAP_FILE"
108
+ sudo snap install --dangerous $SNAP_FILE
109
+
110
+ - name : Verify Redis installation and start Redis
111
+ run : |
112
+ snap list | grep redis
113
+ snap services | grep redis || echo "Redis service not found."
114
+ sudo snap start redis.server
115
+
116
+ - name : Basic Sanity Tests
117
+ run : |
118
+ for i in {1..5}; do redis.cli ping &>/dev/null && break || echo "Waiting for Redis... $i" && sleep 1; done
119
+ redis.cli info server || { echo "Cannot get server info"; exit 1; }
120
+
121
+ - name : Verify installed modules
122
+ run : |
123
+ modules=$(redis.cli module list)
124
+ echo "Installed modules:"
125
+ echo "$modules"
126
+ missing_modules=()
127
+ for module in "bf" "search" "timeseries" "ReJSON"; do
128
+ if ! echo "$modules" | grep -q "$module"; then
129
+ missing_modules+=("$module")
130
+ fi
131
+ done
132
+ if [ ${#missing_modules[@]} -eq 0 ]; then
133
+ echo "All required modules are installed"
134
+ else
135
+ echo "The following modules are missing: ${missing_modules[*]}"
136
+ exit 1
137
+ fi
138
+
139
+ - name : Test RedisBloom
140
+ run : |
141
+ redis.cli BF.ADD popular_keys "redis:hash"
142
+ redis.cli BF.ADD popular_keys "redis:set"
143
+ [ "$(redis.cli BF.EXISTS popular_keys "redis:hash")" = "1" ] || \
144
+ { echo "RedisBloom test failed: 'redis:hash' not found"; exit 1; }
145
+ [ "$(redis.cli BF.EXISTS popular_keys "redis:list")" = "0" ] || \
146
+ { echo "RedisBloom test failed: 'redis:list' found unexpectedly"; exit 1; }
147
+ echo "RedisBloom test passed successfully"
148
+
149
+ - name : Test RediSearch
150
+ run : |
151
+ redis.cli FT.CREATE redis_commands ON HASH PREFIX 1 cmd: SCHEMA name TEXT SORTABLE description TEXT
152
+ redis.cli HSET cmd:set name "SET" description "Set the string value of a key"
153
+ redis.cli HSET cmd:get name "GET" description "Get the value of a key"
154
+ result=$(redis.cli FT.SEARCH redis_commands "value")
155
+ if echo "$result" | grep -q "Set the string value of a key" && \
156
+ echo "$result" | grep -q "Get the value of a key"; then
157
+ echo "RediSearch test passed successfully"
158
+ else
159
+ echo "RediSearch test failed: expected commands not found in search results"
160
+ exit 1
161
+ fi
162
+
163
+ - name : Test RedisTimeSeries
164
+ run : |
165
+ redis.cli TS.CREATE redis:cpu:usage RETENTION 86400
166
+ redis.cli TS.ADD redis:cpu:usage "*" 80
167
+ redis.cli TS.ADD redis:cpu:usage "*" 65
168
+ redis.cli TS.ADD redis:cpu:usage "*" 70
169
+ result=$(redis.cli TS.RANGE redis:cpu:usage - + COUNT 3)
170
+ if echo "$result" | grep -q "80" && \
171
+ echo "$result" | grep -q "65" && \
172
+ echo "$result" | grep -q "70"; then
173
+ echo "RedisTimeSeries test passed successfully"
174
+ else
175
+ echo "RedisTimeSeries test failed: expected values not found in time series"
176
+ exit 1
177
+ fi
178
+
179
+ - name : Test ReJSON
180
+ run : |
181
+ redis.cli JSON.SET redis:config $ '{"maxmemory":"2gb","maxmemory-policy":"allkeys-lru"}'
182
+ result=$(redis.cli JSON.GET redis:config $.maxmemory-policy)
183
+ cleaned_result=$(echo $result | tr -d '[]"')
184
+ if [ "$cleaned_result" = "allkeys-lru" ]; then
185
+ echo "ReJSON test passed successfully"
186
+ else
187
+ echo "ReJSON test failed: expected 'allkeys-lru', got $result"
188
+ exit 1
189
+ fi
190
+
191
+ - name : Check Redis snap status
192
+ run : |
193
+ snap info redis
194
+
195
+ - name : Cleanup
196
+ if : always()
197
+ run : |
198
+ sudo snap remove redis || true
0 commit comments