Skip to content

Commit

Permalink
Update build_test_ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
con-cis authored Aug 19, 2024
1 parent 289b404 commit a4e7649
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions .github/workflows/build_test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,47 @@ jobs:
with:
name: suricata-notify
path: ./

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential xvfb libnotify-bin strace
- name: List Downloaded Files
run: ls -la
sudo apt-get update
sudo apt-get install -y xvfb libnotify-bin strace
- name: Make Executable
run: chmod +x suricata-notify

- name: Create Test Data
run: echo '[{"event_type":"alert","timestamp":"2023-08-02T00:05:06.384656+0200","alert":{"signature":"Test Signature 1","category":"Test Category 1"}},{"event_type":"alert","timestamp":"2023-08-02T00:06:00.000000+0200","alert":{"signature":"Test Signature 2","category":"Test Category 2"}},{"event_type":"alert","timestamp":"2023-08-02T00:07:00.000000+0200","alert":{"signature":"Test Signature 3","category":"Test Category 3"}}]' > eve.json
run: |
echo '[{"event_type":"alert","timestamp":"2023-08-02T00:05:06.384656+0200","alert":{"signature":"Test Signature 1","category":"Test Category 1"}},{"event_type":"alert","timestamp":"2023-08-02T00:06:00.000000+0200","alert":{"signature":"Test Signature 2","category":"Test Category 2"}},{"event_type":"alert","timestamp":"2023-08-02T00:07:00.000000+0200","alert":{"signature":"Test Signature 3","category":"Test Category 3"}}]' > eve.json
- name: Prepare Virtual Display
run: xvfb-run -a -s "-screen 0 1024x768x24" sh -c "strace -o strace.log ./suricata-notify eve.json"
- name: Prepare Virtual Display and Test Notifications
run: |
# Run the program in a virtual display and capture strace logs
xvfb-run -a -s "-screen 0 1024x768x24" sh -c '
echo "Running suricata-notify with strace..."
strace -o /tmp/suricata-notify-strace.log ./suricata-notify eve.json
'
- name: Upload Strace Log
uses: actions/upload-artifact@v3
with:
name: strace-log
path: strace.log
path: /tmp/suricata-notify-strace.log
retention-days: 30

- name: Display Strace Log
run: |
echo "Displaying strace log:"
cat /tmp/suricata-notify-strace.log
- name: Check Strace Log
run: |
# Check for specific output in the strace log to determine success
if grep -q "notify-send" /tmp/suricata-notify-strace.log; then
echo "Notification test passed"
exit 0
else
echo "Notification test failed"
exit 1
fi

0 comments on commit a4e7649

Please sign in to comment.