forked from valkey-io/valkey-glide-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
74 lines (63 loc) · 3.11 KB
/
Copy pathaction.yml
File metadata and controls
74 lines (63 loc) · 3.11 KB
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
name: Install Server
description: "Build and install Valkey server binaries."
inputs:
server-version:
description: "Server version to install (see 'server-matrix.json')"
required: true
runs:
using: "composite"
steps:
- name: Set environment variables
shell: bash
env:
SERVER_VERSION: ${{ inputs.server-version }}
run: echo "SERVER_VERSION=$SERVER_VERSION" >> $GITHUB_ENV
# Environment variables must be passed into WSL explicitly using the WSLENV environment variable.
# The '/p' flag translates the $GITHUB_ENV path from Windows to WSL format.
- name: Pass environment variables to WSL
if: ${{ runner.os == 'Windows' }}
shell: bash
run: |
echo "WSLENV=SERVER_VERSION:GITHUB_ENV/p" >> $GITHUB_ENV
- name: Determine Valkey source version
shell: bash
run: |
# Fetch version.h directly from GitHub, then extract the version number from it.
version_h=$(curl -fsSL "https://raw.githubusercontent.com/valkey-io/valkey/$SERVER_VERSION/src/version.h")
source_version=$(echo "$version_h" | grep -E 'VALKEY_VERSION|REDIS_VERSION' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
if [[ -z "$source_version" ]]; then
echo "Error: Could not determine source version for Valkey $SERVER_VERSION"
exit 1
fi
echo "SOURCE_VERSION=$source_version" >> $GITHUB_ENV
- name: Cache compiled Valkey binaries
id: cache-valkey
uses: actions/cache@v4
with:
path: |
valkey/src/valkey-cli
valkey/src/valkey-server
key: valkey-${{ env.SOURCE_VERSION }}-${{ runner.os }}-${{ runner.arch }}
- name: Build and install Valkey binaries from source
if: ${{ steps.cache-valkey.outputs.cache-hit != 'true' }}
shell: ${{ runner.os == 'Windows' && 'wsl-bash {0}' || 'bash' }}
run: |
git clone --depth 1 --branch "$SERVER_VERSION" --single-branch 'https://github.com/valkey-io/valkey.git'
# Prior to Valkey 7.2, the binaries were named redis-cli and by default.
cd valkey && make BUILD_TLS=yes REDIS_CLI_NAME=valkey-cli REDIS_SERVER_NAME=valkey-server install
- name: Install Valkey binaries from cache
if: ${{ steps.cache-valkey.outputs.cache-hit == 'true' }}
shell: ${{ runner.os == 'Windows' && 'wsl-bash {0}' || 'bash' }}
run: |
sudo cp valkey/src/valkey-cli valkey/src/valkey-server /usr/local/bin
- name: Verify Valkey installation
shell: ${{ runner.os == 'Windows' && 'wsl-bash {0}' || 'bash' }}
run: |
if [ ! -f /usr/local/bin/valkey-cli ] || [ ! -f /usr/local/bin/valkey-server ]; then
echo "Error: Valkey installation failed."
exit 1
else
echo "Installed Valkey:"
valkey-cli --version
valkey-server --version
fi