draft (#231) #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For more infomation, please visit: https://github.com/github/codeql-action | |
name: "CodeQL" | |
on: | |
push: | |
branches: | |
- 'master' | |
- '202[0-9][0-9][0-9]' | |
pull_request: | |
branches: | |
- 'master' | |
- '202[0-9][0-9][0-9]' | |
workflow_dispatch: | |
jobs: | |
analyze: | |
name: Analyze | |
runs-on: ubuntu-20.04 | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
language: [ 'cpp' ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/[email protected] | |
with: | |
config-file: ./.github/codeql/codeql-config.yml | |
languages: ${{ matrix.language }} | |
- name: prepare | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libxml-simple-perl \ | |
aspell \ | |
aspell-en \ | |
libhiredis-dev \ | |
libnl-3-dev \ | |
libnl-genl-3-dev \ | |
libnl-route-3-dev \ | |
libnl-nf-3-dev \ | |
libyang-dev \ | |
libzmq3-dev \ | |
libzmq5 \ | |
swig3.0 \ | |
libpython2.7-dev \ | |
libgtest-dev \ | |
libgmock-dev \ | |
libboost1.71-dev \ | |
libboost-serialization1.71-dev \ | |
libboost-date-time1.71-dev \ | |
libboost-thread1.71-dev \ | |
libboost-log1.71-dev \ | |
libboost-program-options1.71-dev \ | |
dh-exec \ | |
doxygen \ | |
cdbs \ | |
bison \ | |
flex \ | |
graphviz \ | |
autoconf-archive \ | |
uuid-dev \ | |
libjansson-dev \ | |
python \ | |
nlohmann-json3-dev | |
- name: build-swss-common | |
run: | | |
set -x | |
cd .. | |
git clone https://github.com/sonic-net/sonic-swss-common | |
pushd sonic-swss-common | |
git checkout $GITHUB_BASE_REF | |
git reset HEAD --hard | |
./autogen.sh | |
fakeroot dpkg-buildpackage -us -uc -b | |
popd | |
dpkg-deb -x libswsscommon_1.0.0_amd64.deb $(dirname $GITHUB_WORKSPACE) | |
dpkg-deb -x libswsscommon-dev_1.0.0_amd64.deb $(dirname $GITHUB_WORKSPACE) | |
- name: build | |
run: | | |
set -x | |
sed -i "/JOBS := \$(subst -j,,\$(JOB_FLAG))/a JOBS := 1" Makefile | |
sed -i -e "s/ -flto//g" Makefile | |
sed -i '/-include objects.mk/a LIBS := -L'"$(dirname $GITHUB_WORKSPACE)"'/usr/lib/x86_64-linux-gnu \$(LIBS)' Makefile | |
make all INCLUDES="-L$(dirname $GITHUB_WORKSPACE)/usr/lib/x86_64-linux-gnu -I$(dirname $GITHUB_WORKSPACE)/usr/include" | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/[email protected] | |
with: | |
category: "/language:${{matrix.language}}" |