Skip to content

Commit 2f6a1a8

Browse files
committed
actions UPDATE new codeql action
Refs #400
1 parent 31607e5 commit 2f6a1a8

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master", "devel" ]
6+
pull_request:
7+
branches: [ "devel" ]
8+
schedule:
9+
- cron: "33 10 * * 4"
10+
11+
env:
12+
DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-dev
13+
14+
jobs:
15+
git-branch:
16+
name: Get git branch
17+
runs-on: ubuntu-latest
18+
outputs:
19+
branch-name: ${{ steps.get-git-branch.outputs.branch-name }}
20+
steps:
21+
- id: get-git-branch
22+
run: |
23+
if ${{ github.event_name == 'push' }}
24+
then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
25+
else
26+
export GIT_BRANCH=${{ github.base_ref }}
27+
fi
28+
echo "branch-name=$GIT_BRANCH" >> $GITHUB_OUTPUT
29+
30+
analyze:
31+
name: Analyze
32+
runs-on: ubuntu-22.04
33+
needs: git-branch
34+
permissions:
35+
actions: read
36+
contents: read
37+
security-events: write
38+
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
language: [ cpp ]
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
48+
- name: Deps-packages
49+
run: |
50+
sudo apt-get update
51+
sudo apt-get install --yes $DEFAULT_PACKAGES
52+
53+
- name: Deps-libyang
54+
shell: bash
55+
run: |
56+
git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git
57+
cd libyang
58+
mkdir build
59+
cd build
60+
cmake -DCMAKE_INSTALL_PREFIX=$RUNNER_TEMP -DENABLE_BUILD_TESTS=OFF ..
61+
make -j2
62+
sudo make install
63+
64+
- name: Configure
65+
run: |
66+
mkdir build
67+
cd build
68+
cmake -DCMAKE_INCLUDE_PATH=$RUNNER_TEMP/include -DCMAKE_LIBRARY_PATH=$RUNNER_TEMP/lib ..
69+
70+
- name: Initialize CodeQL
71+
uses: github/codeql-action/init@v2
72+
with:
73+
languages: ${{ matrix.language }}
74+
queries: +security-and-quality
75+
76+
- name: Build cpp
77+
run: |
78+
cd build
79+
make -j2
80+
81+
- name: Perform CodeQL Analysis
82+
uses: github/codeql-action/analyze@v2
83+
with:
84+
category: "/language:${{ matrix.language }}"

0 commit comments

Comments
 (0)