Skip to content

Commit c8afe23

Browse files
committed
updated CI with ubuntu
1 parent 7f110ab commit c8afe23

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/ci.yml

+72
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
push:
55
branches:
66
- master
7+
- adding_CI
78
pull_request:
89
branches:
910
- master
11+
- adding_CI
1012

1113
jobs:
1214
build-and-test:
@@ -16,6 +18,76 @@ jobs:
1618
- name: Checkout Code
1719
uses: actions/checkout@v3
1820

21+
- name: Set up Dependencies
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install -y --no-install-recommends \
25+
ca-certificates \
26+
git \
27+
liburing-dev \
28+
cmake \
29+
curl
30+
31+
- name: Clone and Build MetaCall
32+
run: |
33+
git clone --branch v0.8.7 https://github.com/metacall/core
34+
cd core
35+
./tools/metacall-environment.sh release base nodejs c
36+
sudo mkdir build && cd build
37+
sudo cmake \
38+
-DOPTION_BUILD_LOADERS_C=On \
39+
-DOPTION_BUILD_LOADERS_NODE=On \
40+
-DOPTION_BUILD_PORTS=On \
41+
-DOPTION_BUILD_PORTS_NODE=On \
42+
-DOPTION_BUILD_DETOURS=Off \
43+
-DOPTION_BUILD_SCRIPTS=Off \
44+
-DOPTION_BUILD_TESTS=Off \
45+
-DOPTION_BUILD_EXAMPLES=Off \
46+
..
47+
sudo cmake --build . --target install
48+
sudo ldconfig /usr/local/lib
49+
cd ../..
50+
51+
- name: Copy files to destination
52+
run: |
53+
sudo mkdir -p /root/public
54+
sudo mkdir -p /home/scripts
55+
sudo cp index.js /root/
56+
sudo cp -r public/* /root/public/
57+
sudo cp scripts/uring.c /home/scripts/
58+
sudo cp scripts/script.ld /home/scripts/
59+
shell: bash
60+
61+
62+
- name: Run MetaCall Example
63+
run: |
64+
metacallcli /root/index.js
65+
66+
- name: Wait for server to be ready
67+
run: |
68+
for i in {1..10}; do
69+
if curl -s http://localhost:8000 > /dev/null; then
70+
echo "Server is up!"
71+
exit 0
72+
fi
73+
echo "Waiting for server..."
74+
sleep 3
75+
done
76+
echo "Server did not start in time."
77+
exit 1
78+
shell: bash
79+
80+
- name: Test server response
81+
run: |
82+
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8000)
83+
if [ "$RESPONSE" -eq 200 ]; then
84+
echo "Server responded with HTTP 200 OK."
85+
else
86+
echo "Server did not respond with HTTP 200. Response code: $RESPONSE"
87+
exit 1
88+
fi
89+
shell: bash
90+
1991
- name: Test Docker Build
2092
run: |
2193
docker build -t metacall/nodejs-c-liburing-example .

0 commit comments

Comments
 (0)