-
-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (95 loc) · 3.72 KB
/
Build-Linux-x86.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Build Linux x86
on:
workflow_dispatch:
workflow_call:
jobs:
build:
name: Build Linux 32-bit
runs-on: ubuntu-latest
container: i386/ubuntu:latest
continue-on-error: true
steps:
- name: Install git
run: |
apt-get update
apt-get install -y git
- name: Checkout code
run: |
git config --global --add safe.directory /__w/SrcDest/SrcDest
git init
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
git fetch --depth 1 origin ${{ github.ref }}
git checkout FETCH_HEAD
- name: Install dependencies
run: |
apt-get install -y build-essential autoconf automake libtool pkg-config libsqlite3-dev libxxhash-dev libjansson-dev libcurl4-openssl-dev libssl-dev cmake
- name: Install GCC 11
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install -y gcc-11 g++-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100
- name: Download and build libwebsockets
run: |
apt-get install -y wget
wget https://github.com/warmcat/libwebsockets/archive/refs/tags/v4.0.20.tar.gz -O libwebsockets-4.0.20.tar.gz
tar -xzf libwebsockets-4.0.20.tar.gz
cd libwebsockets-4.0.20
mkdir build
cd build
cmake ..
make
make install
- name: Download and compile fswatch
run: |
apt-get install -y wget
wget https://github.com/emcrisostomo/fswatch/releases/download/1.14.0/fswatch-1.14.0.tar.gz
tar -xzf fswatch-1.14.0.tar.gz
cd fswatch-1.14.0
./configure --prefix=/usr
make
make install
ldconfig
- name: Download and build XXHash
run: |
apt-get install -y wget
wget https://github.com/Cyan4973/xxHash/archive/v0.8.1.tar.gz -O xxhash-0.8.1.tar.gz
tar -xzf xxhash-0.8.1.tar.gz
cd xxHash-0.8.1
make
make install
- name: Find fswatch library
run: |
echo "/usr/include/libfswatch/c"
ls -l /usr/include/libfswatch/c
echo "/usr/lib/*fswatch*"
ls -l /usr/lib/*fswatch*
echo "ldconfig"
ldconfig -p
fswatch_lib=$(ldconfig -p | grep 'libfswatch\.so' | head -n 1 | awk '{print $4}')
fswatch_inc=$(find /usr/include -name 'cevent.h' | head -n 1 | xargs dirname)
echo "FSWATCH_LIB=-L$(dirname $fswatch_lib)" >> $GITHUB_ENV
echo "FSWATCH_INC=-I$fswatch_inc" >> $GITHUB_ENV
- name: Build agentc
working-directory: ./AgentC
run: |
gcc --version
gcc agentc.c -o agentc -lsqlite3 -lxxhash -ljansson -lwebsockets ${{ env.FSWATCH_LIB }} -lfswatch ${{ env.FSWATCH_INC }} -lcurl -lssl -lcrypto -pthread
- name: Commit and push changes
run: |
git config --global user.email "github-actions@example.com"
git config --global user.name "GitHub Actions"
rm -rf fswatch-1.14.0.tar.gz fswatch-1.14.0/ libwebsockets-4.0.20.tar.gz libwebsockets-4.0.20/ xxHash-0.8.1/ xxhash-0.8.1.tar.gz
mkdir -p ./dist
cp ./AgentC/agentc ./dist/agentc-linux-x86
git add ./AgentC/agentc
git add ./dist/agentc-linux-x86
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to commit"
else
git commit -m "Update AgentC/agentc and add agentc-linux-x86 to dist folder"
git push "https://${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:main
fi