@@ -16,261 +16,75 @@ jobs:
1616 # The CMake configure and build commands are platform-agnostic and should work equally well on Windows or Mac.
1717 # You can convert this to a matrix build if you need cross-platform coverage.
1818 # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
19- runs-on : ubuntu-latest
19+ runs-on : ubuntu-22.04
2020
2121 steps :
22- - name : Free Disk Space (Ubuntu Host)
23- run : |
24- sudo rm -rf /usr/share/dotnet
25- sudo rm -rf /usr/local/lib/android
26- sudo rm -rf /opt/ghc
27- sudo rm -rf /opt/hostedtoolcache/CodeQL
28- sudo docker system prune -af
2922 - uses : actions/checkout@v4
3023
31- - name : Set up Go
32- uses : actions/setup-go@v5
33- with :
34- go-version : 1.19
35-
36- - name : ccache
37- uses :
hendrikmuhs/[email protected] 38- with :
39- key : ubuntu-latest
40-
41- - name : Install Deps
24+ - name : Build Docker image
4225 run : |
43- sudo apt-get update
44- sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler clang-tidy
45-
46- - name : Configure CMake
47- # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
48- # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
49- run : cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
26+ docker build -t pika-ci -f ci/Dockerfile .
5027
51- - name : Build
52- # Build your program with the given configuration
53- run : cmake --build build --config ${{ env.BUILD_TYPE }}
54-
55- - name : Cleanup
28+ - name : Build Pika (inside Docker)
5629 run : |
57- rm -rf ./buildtrees
30+ docker run --rm \
31+ -v ${{ github.workspace }}:/work \
32+ -w /work \
33+ pika-ci \
34+ bash -c "
35+ rm -rf build buildtrees &&
36+ cmake -B build \
37+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
38+ -DUSE_PIKA_TOOLS=ON &&
39+ cmake --build build -j$(nproc)
40+ "
5841
59- - uses : actions/upload-artifact@v4
60- with :
61- name : ${{ env.ARTIFACT_PIKA_NAME }}
62- path : ${{ github.workspace }}/build/pika
63-
64- - name : Test
65- working-directory : ${{ github.workspace }}/build
66- # Execute tests defined by the CMake configuration.
67- # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
68- run : ctest -C ${{ env.BUILD_TYPE }}
69-
70- - name : Unit Test
71- working-directory : ${{ github.workspace }}
72- run : ./pikatests.sh all clean
73-
74- # master on port 9221, slave on port 9231, all with 2 db
75- - name : Start codis, pika master and pika slave
76- working-directory : ${{ github.workspace }}/build
42+ - name : Run CTest (inside Docker)
7743 run : |
78- chmod +x ../tests/integration/start_master_and_slave.sh
79- ../tests/integration/start_master_and_slave.sh
80- chmod +x ../tests/integration/start_codis.sh
81- ../tests/integration/start_codis.sh
44+ docker run --rm \
45+ -v ${{ github.workspace }}:/work \
46+ -w /work/build \
47+ pika-ci \
48+ ctest --output-on-failure
8249
83- - name : Run Go E2E Tests
84- working-directory : ${{ github.workspace }}/build
50+ - name : Unit Test
8551 run : |
86- cd ../tools/pika_keys_analysis/
87- go test -v ./...
88- cd ../../tests/integration/
89- chmod +x integrate_test.sh
90- sh integrate_test.sh
91-
52+ docker run --rm \
53+ -v ${{ github.workspace }}:/work \
54+ -w /work \
55+ pika-ci \
56+ bash -c "./pikatests.sh all clean"
57+
9258 build_on_rocky :
93- runs-on : ubuntu-latest
94- container :
95- image : rockylinux:9
96-
59+ runs-on : ubuntu-22.04
9760 steps :
98- - name : set up mirror
99- run : |
100- rm -rf /etc/yum.repos.d/CentOS-Base.repo
101- cat > /etc/yum.repos.d/CentOS-Base.repo << EOL
102- [base]
103- name=CentOS-\$releasever - Base
104- baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/os/\$basearch/
105- gpgcheck=1
106- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
107-
108- [updates]
109- name=CentOS-\$releasever - Updates
110- baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/updates/\$basearch/
111- gpgcheck=1
112- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
113-
114- [extras]
115- name=CentOS-\$releasever - Extras
116- baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/extras/\$basearch/
117- gpgcheck=1
118- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
119-
120- [centosplus]
121- name=CentOS-\$releasever - Plus
122- baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/centosplus/\$basearch/
123- gpgcheck=1
124- enabled=0
125- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
126- EOL
127-
128- cat > /etc/yum.repos.d/CentOS-SCLo-scl.repo << EOL
129- [centos-sclo-sclo]
130- name=CentOS-7 - SCLo sclo
131- baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
132- gpgcheck=1
133- enabled=1
134- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
135-
136- [centos-sclo-sclo-source]
137- name=CentOS-7 - SCLo sclo Source
138- baseurl=https://mirrors.aliyun.com/centos/7/sclo/Source/sclo/
139- gpgcheck=1
140- enabled=0
141- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
142- EOL
143-
144- cat > /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo << EOL
145- [centos-sclo-rh]
146- name=CentOS-7 - SCLo rh
147- baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
148- gpgcheck=1
149- enabled=1
150- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
151-
152- [centos-sclo-rh-source]
153- name=CentOS-7 - SCLo rh Source
154- baseurl=https://mirrors.aliyun.com/centos/7/sclo/Source/rh/
155- gpgcheck=1
156- enabled=0
157- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
158- EOL
159-
160- rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
161- rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-SCLo
162-
163- yum clean all
164- yum makecache
165-
166- - name : Install deps
167- run : |
168- dnf update -y
169- dnf install -y bash cmake wget git autoconf gcc perl-Digest-SHA tcl which tar g++ tar epel-release gcc-c++ libstdc++-devel gcc-toolset-13 binutils
170- dnf clean all
171- rm -rf /var/cache/dnf
172-
173- - name : Set up Go
174- uses : actions/setup-go@v5
175- with :
176- go-version : 1.19
177-
178- - name : Checkout
179- uses : actions/checkout@v4
180- with :
181- fetch-depth : 1
182-
183- - name : Configure CMake
184- run : |
185- source /opt/rh/gcc-toolset-13/enable
186- cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address .
187-
188- - uses : actions/cache@v3
189- with :
190- path : ${{ github.workspace }}/deps
191- key : ${{ runner.os }}-rocky-deps-${{ hashFiles('**/CMakeLists.txt') }}
192-
193- - uses : actions/cache@v3
194- with :
195- path : ${{ github.workspace }}/buildtrees
196- key : ${{ runner.os }}-rocky-buildtrees-${{ hashFiles('**/CMakeLists.txt') }}
197-
198- - name : Build
199- run : |
200- source /opt/rh/gcc-toolset-13/enable
201- cmake --build build --config ${{ env.BUILD_TYPE }}
202-
203- - name : Cleanup
204- run : |
205- rm -rf ./buildtrees
206- rm -rf ./build/Testing
207- rm -rf ./deps/src ./deps/include ./deps/share
208-
209- echo "Cleaning up object files to save space..."
210- find ./build -name "*.o" -type f -delete
211- find ./build -name "*.a" -type f -delete
212- find ./build -name "*.pb.cc" -type f -delete
213- find ./build -name "*.pb.h" -type f -delete
214-
215- echo "Stripping debug symbols from binaries..."
216- find ./build -type f -executable -not -name "*.sh" -exec strip --strip-debug {} \; || true
217- rm -rf .git
218- rm -rf include
219- rm -rf docs
220- rm -rf tools/codis_to_pika tools/aof_to_pika tools/binlog_sender
221- rm -rf codis/ansible codis/example codis/doc
222-
223- - name : Test
224- working-directory : ${{ github.workspace }}/build
225- run : ctest -C ${{ env.BUILD_TYPE }}
226-
227- - name : Unit Test
228- working-directory : ${{ github.workspace }}
229- run : ./pikatests.sh all clean
230-
231- - name : Cleanup artifacts
232- working-directory : ${{ github.workspace }}/build
233- run : |
234- df -h
235- rm -rf Testing CMakeFiles CMakeCache.txt cmake_install.cmake Makefile
236- find . -name "*.o" -o -name "*.a" -delete
237- find . -name "*.log" -delete
238- find . -name "*.cmake" -delete
239- find . -type d -name "CMakeFiles" -exec rm -rf {} + || true
240- find . -name "*.pb.cc" -o -name "*.pb.h" -delete || true
241- find . -type f -name "*_test" -executable -delete || true
242- find ./src/storage/tests -type f -perm -111 -delete || true
243- find ../deps -name "*.a" -delete
244-
245- go clean -cache -testcache -modcache
246- rm -rf /root/.cache/go-build /root/go/pkg/mod
247- rm -rf ../log ../pika_log ../dump ../*.log ../dbsync ../db[0-9]* ../log[0-9]*
248- find ../src -name "*.o" -delete || true
249- dnf clean all
250- rm -rf /var/cache/dnf /tmp/* /var/tmp/*
251- du -h --max-depth=3 .. | sort -hr | head -n 20
252- find .. -type f -exec du -h {} + | sort -hr | head -n 20
253- du -h --max-depth=1 / | sort -hr | head -n 15
254- df -h
255-
256- - name : Start codis, pika master and pika slave
257- working-directory : ${{ github.workspace }}/build
258- run : |
259- chmod +x ../tests/integration/start_master_and_slave.sh
260- ../tests/integration/start_master_and_slave.sh
261- chmod +x ../tests/integration/start_codis.sh
262- ../tests/integration/start_codis.sh
263-
264- - name : Run Go E2E Tests
265- working-directory : ${{ github.workspace }}/build
266- run : |
267- find . -name "pika.conf" -exec sed -i 's/loglevel : info/loglevel : error/g' {} +
268- find . -name "pika.conf" -exec sed -i 's/loglevel : debug/loglevel : error/g' {} +
269- cd ../tools/pika_keys_analysis/
270- go test -v ./...
271- cd ../../tests/integration/
272- chmod +x integrate_test.sh
273- sh integrate_test.sh
61+ - uses : actions/checkout@v4
62+
63+ - name : Build Docker image for Rocky CI
64+ run : |
65+ docker build -t pika-rocky-ci -f ci/Dockerfile-rocky .
66+
67+ - name : Run build inside container
68+ run : |
69+ docker run --rm \
70+ -v ${{ github.workspace }}:/work \
71+ -w /work \
72+ pika-rocky-ci \
73+ bash -c "rm -rf build buildtrees && cmake -B build -DCMAKE_BUILD_TYPE=Release -DUSE_PIKA_TOOLS=ON && cmake --build build -j2"
74+ - name : Run CTest (inside Docker)
75+ run : |
76+ docker run --rm \
77+ -v ${{ github.workspace }}:/work \
78+ -w /work/build \
79+ pika-ci \
80+ ctest --output-on-failure
81+ - name : Unit Test
82+ run : |
83+ docker run --rm \
84+ -v ${{ github.workspace }}:/work \
85+ -w /work \
86+ pika-ci \
87+ bash -c "./pikatests.sh all clean"
27488
27589 build_on_macos :
27690
0 commit comments