-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (55 loc) · 1.96 KB
/
ci.yaml
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
name: CI
run-name: ${{ github.actor }} run CI
on: [push]
jobs:
build-test:
runs-on: ubuntu-24.04
steps:
- name: Check out repository code
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: 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
with:
name: client
path: ./client/http-client.deb
- run: sh create_debpkg_server.sh
- name: Upload server artifact
uses: actions/upload-artifact@v4
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
run: |
libhv-http & SERVER_PID=$!
sleep 5
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: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/http-server:${{ github.sha }} .
- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/http-server:${{ github.sha }}