Skip to content

Commit b8e8c6f

Browse files
author
Alvaro Muñoz
committed
Add CodeQL workflow
1 parent 1ecffb1 commit b8e8c6f

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/codeql.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ 'master' ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ 'master' ]
9+
schedule:
10+
- cron: '2 14 * * 2'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: [ 'cpp', 'python' ]
25+
include:
26+
- os: ubuntu-18.04
27+
DB: none
28+
OSSEC_TYPE: agent
29+
GEOIP: no
30+
PCRE2_SYSTEM: no
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v3
35+
36+
- name: Initialize CodeQL
37+
uses: github/codeql-action/init@v2
38+
with:
39+
languages: ${{ matrix.language }}
40+
41+
- run: |
42+
sudo apt-get update -qq
43+
sudo apt-get install -y libevent-dev libsystemd-dev
44+
wget https://ftp.pcre.org/pub/pcre/pcre2-10.32.tar.gz && tar xzf pcre2-10.32.tar.gz -C src/external
45+
if [[ "${GEOIP}" == "yes" ]]; then ( sudo apt-get install geoip-bin geoip-database libgeoip-dev libgeoip1 ); fi
46+
if [[ "${PRELUDE}" == "yes" ]]; then ( sudo apt-get install libprelude-dev ); fi
47+
if [[ "${ZEROMQ}" == "yes" ]]; then ( sudo apt-get install libzmq3-dev libtool autoconf libczmq-dev ); fi
48+
if [[ "${OSSEC_TYPE}" == "winagent" ]]; then ( sudo apt-get install aptitude && sudo aptitude -y install mingw-w64 nsis ); fi
49+
if [[ "${OSSEC_TYPE}" == "server" ]]; then ( sudo apt-get install libsqlite3-dev sqlite3 ); fi
50+
if [[ "${OSSEC_TYPE}" == "test" ]]; then if [ `uname -m` = "aarch64"]; then (sudo apt-get install check libc6-dbg && wget -q http://ports.ubuntu.com/pool/main/v/valgrind/valgrind_3.15.0-1ubuntu9.1_arm64.deb && sudo dpkg -i valgrind_3.15.0-1ubuntu9.1_arm64.deb ) ; else ( sudo apt-get install check valgrind ); fi; fi
51+
COMMAND="V=1 TARGET=${OSSEC_TYPE}" && if ! [[ "${DB}" = "none" ]]; then COMMAND="${COMMAND} DATABASE=${DB}"; fi && if [[ "${GEOIP}" = "yes" ]]; then COMMAND="${COMMAND} USE_GEOIP=1"; fi && if [[ "${PRELUDE}" = "yes" ]]; then COMMAND="${COMMAND} USE_PRELUDE=1"; fi && if [[ "${ZEROMQ}" = "yes" ]]; then COMMAND="${COMMAND} USE_ZEROMQ=1"; fi && if [[ "${OSSEC_TYPE}" = "test" ]]; then COMMAND="${COMMAND} USE_PCRE2_JIT=0"; fi && if [[ "${ARCH}" = "arm64" ]]; then ./build.sh; fi && ( cd src/ && make --warn-undefined-variables ${COMMAND} settings && make --warn-undefined-variables ${COMMAND} external -j && make --warn-undefined-variables ${COMMAND} -j ) && if ! [[ "${OSSEC_TYPE}" = "test" || "${OSSEC_TYPE}" = "winagent" ]]; then ( cd src/ && sudo make --warn-undefined-variables ${COMMAND} install ) fi
52+
if [[ "${OSSEC_TYPE}" == "test" ]]; then ( cd src/ && make --warn-undefined-variables test_valgrind ) fi
53+
if [[ "${RULES}" == "test" ]]; then ( cd src/ && sudo make V=1 TARGET=server test-rules ) fi
54+
env:
55+
DB: '${{ matrix.DB }}'
56+
OSSEC_TYPE: '${{ matrix.OSSEC_TYPE }}'
57+
GEOIP: '${{ matrix.GEOIP }}'
58+
PCRE2_SYSTEM: '${{ matrix.PCRE2_SYSTEM }}'
59+
RULES: '${{ matrix.RULES }}'
60+
61+
- name: Perform CodeQL Analysis
62+
uses: github/codeql-action/analyze@v2
63+
with:
64+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)