@@ -47,29 +47,29 @@ jobs:
4747 needs : linux-test-x86
4848 runs-on : ubuntu-latest
4949 steps :
50- - uses : docker/setup-qemu-action@v1
51- with :
52- platforms : all
5350 - uses : actions/checkout@v3
54- - name : Set up Docker Buildx
55- uses : docker/setup-buildx-action@v1
56- - name : Install prerequisites and build project using qemu
51+ - uses : docker/setup-qemu-action@v1
52+ - uses : docker/setup-buildx-action@v1
53+
54+ - name : Build and test in Docker container
5755 run : |
56+ # Ubuntu base image with ARM64 architecture
5857 docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
59- docker buildx create --name mybuilder --use
60- docker buildx build --platform linux/arm64 -o type=docker -t myimage .
61- docker run myimage
62- - name : Clone project repository
63- run : |
64- git clone https://github.com/lk-libs/libcpp-http-client.git /root/libcpp-http-client
65- - name : Run cmake with vcpkg toolchain
66- run : |
67- cd /root/libcpp-http-client
68- cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake
69- - name : Build the project using Buildx
70- run : |
71- docker buildx build --platform linux/arm64 -o type=docker -t myproject .
72- docker run myproject
73- - name : Run tests in Docker
74- run : |
75- docker run myproject /root/libcpp-http-client/build/test/test
58+ docker run --name mycontainer -d -t --platform linux/arm64 ubuntu:22.04 tail -f /dev/null
59+
60+ # Prepare the environment inside the container
61+ docker exec mycontainer bash -c "apt-get update && apt-get install -y build-essential g++ make cmake pkg-config git wget curl zip unzip tar"
62+ docker exec mycontainer bash -c "git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg && /opt/vcpkg/bootstrap-vcpkg.sh && ln -s /opt/vcpkg/vcpkg /usr/local/bin/vcpkg"
63+
64+ # Copy project files into the container
65+ docker cp . mycontainer:/root/libcpp-http-client
66+
67+ # Run CMake and build inside the container
68+ docker exec mycontainer bash -c "cd /root/libcpp-http-client && cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake"
69+ docker exec mycontainer bash -c "cd /root/libcpp-http-client && cmake --build build --config Release"
70+
71+ # Run tests
72+ docker exec mycontainer bash -c "cd /root/libcpp-http-client/build && ./test/test"
73+
74+ # Stop the container
75+ docker stop mycontainer
0 commit comments