|
4 | 4 | push:
|
5 | 5 | branches:
|
6 | 6 | - master
|
| 7 | + - adding_CI |
7 | 8 | pull_request:
|
8 | 9 | branches:
|
9 | 10 | - master
|
| 11 | + - adding_CI |
10 | 12 |
|
11 | 13 | jobs:
|
12 | 14 | build-and-test:
|
|
16 | 18 | - name: Checkout Code
|
17 | 19 | uses: actions/checkout@v3
|
18 | 20 |
|
| 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 | + |
19 | 91 | - name: Test Docker Build
|
20 | 92 | run: |
|
21 | 93 | docker build -t metacall/nodejs-c-liburing-example .
|
|
0 commit comments