From b630c72461f7369dbdc149b2e38e0e2e234f6137 Mon Sep 17 00:00:00 2001 From: Egor Suldin Date: Sun, 22 Jun 2025 01:50:56 +0300 Subject: [PATCH 1/4] Add CodeQL analysis --- .github/workflows/codeql.yml | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..000e6c6 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,53 @@ +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: "38 1 * * 0" + +jobs: + analyze: + name: Analyze ${{matrix.language}} + runs-on: ubuntu-latest + permissions: + security-events: write + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: c-cpp + build-mode: manual + - language: python + build-mode: none + steps: + - name: Checkout the code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive + - name: Set up Python 3 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: 3 + - name: Install dependencies for Python + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{matrix.language}} + build-mode: ${{matrix.build-mode}} + queries: security-extended,security-and-quality + - if: matrix.build-mode == 'manual' + run: | + python -m build + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 495db009690937229b287f2f47856512b1510602 Mon Sep 17 00:00:00 2001 From: Egor Suldin Date: Sun, 22 Jun 2025 02:16:26 +0300 Subject: [PATCH 2/4] Replace tag with commit hash --- .github/workflows/codeql.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 000e6c6..58e6885 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -5,8 +5,6 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] - schedule: - - cron: "38 1 * * 0" jobs: analyze: @@ -39,7 +37,7 @@ jobs: python -m pip install --upgrade pip python -m pip install -r requirements.txt - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0 with: languages: ${{matrix.language}} build-mode: ${{matrix.build-mode}} @@ -48,6 +46,6 @@ jobs: run: | python -m build - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0 with: category: "/language:${{matrix.language}}" From a8fbdc2b09b70af4658461bf3c25b79f77f6d2c6 Mon Sep 17 00:00:00 2001 From: Egor Suldin Date: Sun, 22 Jun 2025 02:22:03 +0300 Subject: [PATCH 3/4] Restore regular runs --- .github/workflows/codeql.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 58e6885..d4fd127 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -5,6 +5,8 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + - cron: "38 1 * * 0" jobs: analyze: From b75a7ee20f37ef5ae7742ada4e21360e57d6e338 Mon Sep 17 00:00:00 2001 From: Egor Suldin Date: Sun, 22 Jun 2025 02:32:55 +0300 Subject: [PATCH 4/4] Replace build command for native code --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d4fd127..6bf2296 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: queries: security-extended,security-and-quality - if: matrix.build-mode == 'manual' run: | - python -m build + python setup.py build_ext --inplace - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0 with: