-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 2.07 KB
/
linux.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
name: linux
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
services:
postgres:
image: postgres
env:
POSTGRES_DB: my_db
POSTGRES_USER: my_user
POSTGRES_PASSWORD: my_password
options: >-
--health-cmd "pg_isready -U my_user -d my_db"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Enable core dumps
run: ulimit -c unlimited
- uses: actions/checkout@v3
- name: Install prerequisites
run: |
apt update
apt install -y build-essential g++ make cmake pkg-config git wget curl zip unzip tar gdb postgresql-client bison flex autoconf
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg
/opt/vcpkg/bootstrap-vcpkg.sh
ln -s /opt/vcpkg/vcpkg /usr/local/bin/vcpkg
- name: Clone project repository
run: |
git clone https://github.com/leventkaragol/libcpp-pg-pool.git /root/libcpp-pg-pool
- name: Run cmake with vcpkg toolchain
run: |
cd /root/libcpp-pg-pool
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build the project
run: |
cd /root/libcpp-pg-pool
cmake --build build --config Release
- name: Wait for Postgres to be ready
run: |
until pg_isready -h postgres -p 5432 -U my_user; do
echo "Waiting for postgres...";
sleep 2;
done
- name: Create table in the database
run: |
PGPASSWORD=my_password psql -h postgres -U my_user -d my_db -c "CREATE TABLE my_table (id SERIAL PRIMARY KEY, description TEXT);"
- name: Run tests with gdb
run: |
cd /root/libcpp-pg-pool
gdb -ex "run" -ex "bt" -ex "quit" --args ./build/test/test