Skip to content

Build Linux x64

Build Linux x64 #41

name: Build Linux x64
on:
workflow_dispatch:
workflow_call:
jobs:
build:
name: Build Linux 64-bit
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsqlite3-dev libxxhash-dev libjansson-dev libwebsockets-dev fswatch libcurl4-openssl-dev libssl-dev
- name: Find fswatch library
run: |
dpkg -s fswatch
dpkg -L fswatch
fswatch_lib=$(dpkg -L fswatch | grep 'libfswatch\.so' | head -n 1)
fswatch_inc=$(dpkg -L fswatch | grep '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 agentc.c -o agentc -lsqlite3 -lxxhash -ljansson -lwebsockets ${{ env.FSWATCH_LIB }} -lfswatch ${{ env.FSWATCH_INC }} -lcurl -lssl -lcrypto
- name: Commit and push changes
run: |
git config --global user.email "github-actions@example.com"
git config --global user.name "GitHub Actions"
mkdir -p ./dist
cp ./AgentC/agentc ./dist/agentc-linux-x64
git add ./AgentC/agentc
git add ./dist/agentc-linux-x64
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to commit"
else
git commit -m "Update AgentC/agentc and add agentc-linux-x64 to dist folder"
git push "https://${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:main
fi