From 2a3bbf2c930e23f0b5e12090eef156b7afd0e54a Mon Sep 17 00:00:00 2001 From: Alexey-Sagaydak Date: Sun, 10 Nov 2024 22:21:38 +0700 Subject: [PATCH] fixed yaml --- .github/workflows/ci.yaml | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0844154..27d57a3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,12 +11,13 @@ jobs: uses: actions/checkout@v3 - run: sudo apt-get update - - run: sudo apt-get install g++ make cmake - - run: sudo apt-get install -y libboost-all-dev + - run: sudo apt-get install -y g++ make cmake libboost-all-dev libpqxx-dev docker-compose - - run: cd client && mkdir -p build && cd build && cmake .. && make && cd ../../server && mkdir -p build && cd build && cmake .. && make + - run: | + cd client && mkdir -p build && cd build && cmake .. && make + cd ../../server && mkdir -p build && cd build && cmake .. && make - run: cd ../.. - + - run: sh create_debpkg_client.sh - name: Upload client artifact uses: actions/upload-artifact@v4 @@ -30,30 +31,27 @@ jobs: with: name: server path: ./server/http-server.deb - + - name: Test 1. Install client run: sudo dpkg -i ./client/http-client.deb - - name: Test 2. Test client run: echo "6" | libhv-client - - - name: Test 3. Install server - run: sudo dpkg -i ./server/http-server.deb - - - name: Test 4. Test server + + - name: Start server and database with Docker Compose + run: docker-compose up -d + + - name: Test server health run: | - libhv-http & SERVER_PID=$! - sleep 5 + sleep 10 # Даем время серверу на старт curl --silent --head http://localhost:7777 | grep "HTTP/1.1 200 OK" > /dev/null if [ "$?" -eq 0 ]; then echo "Сервер успешно запущен" - kill $SERVER_PID - exit 0 else echo "Ошибка при запуске сервера" - kill $SERVER_PID exit 1 fi + - name: Stop Docker Compose + run: docker-compose down - name: Log in to Docker Hub uses: docker/login-action@v2 @@ -62,7 +60,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker image - run: docker build -t ${{ secrets.DOCKER_USERNAME }}/http-server:${{ github.sha }} . + run: docker-compose build http-server - name: Push Docker image run: docker push ${{ secrets.DOCKER_USERNAME }}/http-server:${{ github.sha }}