From 3ef5514936983d4d4c531b99287d81aa471c4883 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 20 Aug 2024 00:18:34 +0200 Subject: [PATCH] add xvfb-run --- .github/workflows/build_test_ci.yml | 35 +++++++++++++++-------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build_test_ci.yml b/.github/workflows/build_test_ci.yml index 9f61540..5b695e7 100644 --- a/.github/workflows/build_test_ci.yml +++ b/.github/workflows/build_test_ci.yml @@ -15,7 +15,9 @@ jobs: uses: actions/checkout@v4 - name: Install Dependencies - run: sudo apt-get update && sudo apt-get install -y build-essential libjansson-dev libnotify-bin + run: | + sudo apt-get update + sudo apt-get install -y build-essential libjansson-dev xvfb libnotify-bin strace - name: Compile C Program run: gcc -o suricata-notify suricata-notify.c -ljansson @@ -27,33 +29,32 @@ jobs: path: suricata-notify retention-days: 30 - test: + download: runs-on: ubuntu-latest needs: build steps: - - name: Download Build Artifact + - name: Download Artifact uses: actions/download-artifact@v3 with: name: suricata-notify path: ./ - - 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 + - name: List Downloaded Files + run: ls -la - name: Make Executable - run: chmod +x ./suricata-notify + run: chmod +x suricata-notify - - name: Check if notify is installed - run: which notify-send - - - name: Send test notification - run: notify-send "Test Notification" + - 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 - - name: Set display env - run: export DISPLAY=:0 + - name: Prepare Virtual Display + run: xvfb-run -a -s "-screen 0 1024x768x24" sh -c "strace -o strace.log ./suricata-notify eve.json" - - name: Run Program with strace - run: | - strace -e trace=execve ./suricata-notify eve.json 2>&1 | tee strace.log - grep "notify-send" strace.log || (echo "Test failed: notify-send not executed correctly" && exit 1) + - name: Upload Strace Log + uses: actions/upload-artifact@v3 + with: + name: strace-log + path: strace.log + retention-days: 30