-
Notifications
You must be signed in to change notification settings - Fork 89
258 lines (237 loc) · 8.63 KB
/
Copy pathci.yml
File metadata and controls
258 lines (237 loc) · 8.63 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
name: MinIO C++ Cmake
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# This ensures that previous jobs for the PR are canceled when the PR is
# updated.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu_Latest_GCC",
os: ubuntu-latest,
arch: "amd64",
build_type: "Release",
cc: "gcc",
cxx: "g++",
cpp_std: "17"
}
- {
name: "Ubuntu_Latest_GCC_CXX20",
os: ubuntu-latest,
arch: "amd64",
build_type: "Release",
cc: "gcc",
cxx: "g++",
cpp_std: "20"
}
- {
name: "Ubuntu_Latest_GCC_arm64",
os: ubuntu-24.04-arm,
arch: "arm64",
build_type: "Release",
cc: "gcc",
cxx: "g++",
cpp_std: "17"
}
- {
name: "Ubuntu_Latest_GCC_arm64_CXX20",
os: ubuntu-24.04-arm,
arch: "arm64",
build_type: "Release",
cc: "gcc",
cxx: "g++",
cpp_std: "20"
}
- {
name: "macOS Latest Clang",
os: macos-latest,
build_type: "Release",
cc: "clang",
cxx: "clang++",
cpp_std: "17"
}
- {
name: "macOS Latest Clang CXX20",
os: macos-latest,
build_type: "Release",
cc: "clang",
cxx: "clang++",
cpp_std: "20"
}
- {
name: "Windows Latest MSVC",
os: windows-latest,
build_type: "Release",
cc: "cl",
cxx: "cl",
cpp_std: "17"
}
- {
name: "Windows Latest MSVC CXX20",
os: windows-latest,
build_type: "Release",
cc: "cl",
cxx: "cl",
cpp_std: "20"
}
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
steps:
- name: Checkout minio-cpp
uses: actions/checkout@v4
with:
path: "minio-cpp"
- name: Checkout vcpkg
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
ref: "2026.07.29"
path: "vcpkg"
# arm64 Linux has no prebuilt vcpkg CMake, so vcpkg falls back to the system
# cmake; the apt version (3.28) is too old for vcpkg's SPDX generation
# (string(JSON ... STRING_ENCODE)). Provide a recent cmake on PATH.
- name: Install recent CMake and Ninja
uses: lukka/get-cmake@fffaaafeea488556c2c12dad60690008bc1caacb # v4.4.2
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Install dependencies if Ubuntu
if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
run: |
. ./minio-cpp/.github/minio-release.env
arch=${{ matrix.config.arch }}
case "$arch" in
amd64) expected=$MINIO_SHA256_LINUX_AMD64 ;;
arm64) expected=$MINIO_SHA256_LINUX_ARM64 ;;
*) echo "no pinned digest for linux-$arch" >&2; exit 1 ;;
esac
wget --quiet -O minio "https://dl.min.io/aistor/minio/release/linux-${arch}/archive/minio.${MINIO_RELEASE}"
echo "${expected} minio" | sha256sum -c -
chmod +x minio
cmake --version
./minio --version
- name: Install dependencies if macOS
if: startsWith(matrix.config.os, 'macos')
run: |
brew install pkg-config cmake
. ./minio-cpp/.github/minio-release.env
curl -fsSL -o minio "https://dl.min.io/aistor/minio/release/darwin-arm64/archive/minio.${MINIO_RELEASE}"
echo "${MINIO_SHA256_DARWIN_ARM64} minio" | shasum -a 256 -c -
chmod +x minio
cmake --version
./minio --version
- name: Install dependencies if Windows
shell: bash
if: startsWith(matrix.config.os, 'windows')
run: |
choco install -y --no-progress cmake wget
. ./minio-cpp/.github/minio-release.env
wget --quiet -O minio.exe "https://dl.min.io/aistor/minio/release/windows-amd64/archive/minio.exe.${MINIO_RELEASE}"
echo "${MINIO_SHA256_WINDOWS_AMD64} minio.exe" | sha256sum -c -
chmod +x minio.exe
cmake --version
- name: Configure and Build
shell: bash
run: |
./vcpkg/bootstrap-vcpkg.sh
cd minio-cpp
../vcpkg/vcpkg install
cmake . -B ./build -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake -DMINIO_CPP_TEST:BOOL=ON -DMINIO_CPP_STD=${{matrix.config.cpp_std}}
cmake --build ./build --config ${{matrix.config.build_type}} -j 4
- name: Start MinIO server if Ubuntu
if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
run: |
mkdir -p ~/.minio/certs
cp ./minio-cpp/tests/public.crt ./minio-cpp/tests/private.key ~/.minio/certs/
sudo cp ./minio-cpp/tests/public.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
export MINIO_LICENSE=$(cat ./minio-cpp/.github/aistor-free-license.jwt)
MINIO_CI_CD=true ./minio server /tmp/test-xl/{1...4}/ &
sleep 10
- name: Start MinIO server if macOS
if: startsWith(matrix.config.name, 'macos')
run: |
export MINIO_LICENSE=$(cat ./minio-cpp/.github/aistor-free-license.jwt)
MINIO_CI_CD=true ./minio server test-xl/{1...4}/ &
sleep 10
- name: Start MinIO server if Windows
if: startsWith(matrix.config.os, 'windows')
shell: bash
run: |
mkdir -p ~/.minio/certs
cp ./minio-cpp/tests/public.crt ./minio-cpp/tests/private.key ~/.minio/certs/
certutil -addstore -f "ROOT" ./minio-cpp/tests/public.crt
export MINIO_LICENSE=$(cat ./minio-cpp/.github/aistor-free-license.jwt)
MINIO_CI_CD=true ./minio.exe server test-xl/{1...4}/ &
sleep 10
- name: Run tests if Ubuntu
if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
run: |
SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ENABLE_HTTPS=1 ./minio-cpp/build/tests
- name: Run tests if macOS
if: startsWith(matrix.config.name, 'macos')
run: |
SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ./minio-cpp/build/tests
- name: Run tests if Windows
shell: bash
if: startsWith(matrix.config.os, 'windows')
run: |
SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ENABLE_HTTPS=1 ./minio-cpp/build/Release/tests.exe
- name: Run CMake test
run: |
cd minio-cpp/build
ctest -C ${{ matrix.config.build_type }}
# Alpine/musl: vcpkg's default setup downloads glibc-linked tools, and
# Alpine lacks httplib / INIReader packages -- exercises the pkg-config +
# upstream source fallback path.
build-alpine:
name: Alpine_Latest_GCC
runs-on: ubuntu-latest
container: alpine:3.24@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b
steps:
- name: Install dependencies
run: |
apk add --no-cache build-base cmake git ninja pkgconf \
inih-dev nlohmann-json openssl-dev pugixml-dev zlib-dev
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- name: Configure and Build
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DMINIO_CPP_TEST=ON
cmake --build build
- name: Start MinIO server
run: |
. .github/minio-release.env
wget --quiet -O minio "https://dl.min.io/aistor/minio/release/linux-amd64/archive/minio.${MINIO_RELEASE}"
echo "${MINIO_SHA256_LINUX_AMD64} minio" | sha256sum -c -
chmod +x minio
mkdir -p /data
export MINIO_LICENSE=$(cat .github/aistor-free-license.jwt)
MINIO_CI_CD=true ./minio server /data --address 127.0.0.1:9000 &
MINIO_PID=$!
for i in $(seq 1 30); do
if wget -q -O /dev/null http://127.0.0.1:9000/minio/health/live; then
exit 0
fi
kill -0 $MINIO_PID 2>/dev/null || { echo "MinIO server exited"; exit 1; }
sleep 1
done
echo "MinIO server did not become ready"
exit 1
- name: Run tests
run: |
SERVER_ENDPOINT=127.0.0.1:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin \
./build/tests