-
Notifications
You must be signed in to change notification settings - Fork 56
155 lines (136 loc) · 4.94 KB
/
ci.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
153
154
155
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:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu_Latest_GCC",
os: Ubuntu-latest,
build_type: "Release",
cc: "gcc",
cxx: "g++"
}
- {
name: "macOS Latest Clang",
os: macos-latest,
build_type: "Release",
cc: "clang",
cxx: "clang++"
}
- {
name: "Windows Latest MSVC",
os: windows-latest,
build_type: "Release",
cc: "cl",
cxx: "cl"
}
steps:
- uses: actions/checkout@v2
- 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: |
wget --quiet -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' | sudo tee -a /etc/apt/sources.list
sudo apt-get -qy update
sudo apt-get -qy install cmake clang-format-14
wget --quiet https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
cmake --version
clang-format --version
./minio --version
- name: Install dependencies if macOS
if: startsWith(matrix.config.os, 'macos')
run: |
brew install pkg-config cmake clang-format minio/stable/minio
cmake --version
minio --version
clang-format --version
- name: Install dependencies if Windows
shell: bash
if: startsWith(matrix.config.os, 'windows')
run: |
choco install -y --no-progress cmake wget
wget --quiet https://dl.min.io/server/minio/release/windows-amd64/minio.exe
chmod +x minio.exe
cmake --version
- name: Install vcpkg
shell: bash
run: |
mkdir -p ~/.vcpkg
touch ~/.vcpkg/vcpkg.path.txt
wget --quiet -O vcpkg-master.zip https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip
unzip -qq vcpkg-master.zip
./vcpkg-master/bootstrap-vcpkg.sh
./vcpkg-master/vcpkg integrate install
./vcpkg-master/vcpkg install
- name: C++ Style check if not Windows
if: ${{ !startsWith(matrix.config.os, 'windows') }}
shell: bash
run: |
./check-style.sh
- name: Configure and Build
shell: bash
run: |
cmake -B ./build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_TOOLCHAIN_FILE=./vcpkg-master/scripts/buildsystems/vcpkg.cmake
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 ./tests/public.crt ./tests/private.key ~/.minio/certs/
sudo cp ./tests/public.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
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: |
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 ./tests/public.crt ./tests/private.key ~/.minio/certs/
certutil -addstore -f "ROOT" ./tests/public.crt
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 ./build/tests/tests
- name: Run tests if macOS
if: startsWith(matrix.config.name, 'macos')
run: |
SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ./build/tests/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 ./build/tests/Release/tests.exe
- name: Run CMake test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ matrix.config.build_type }}