From 02049c8811af87d4435a4420ceb7784f1c5a1d64 Mon Sep 17 00:00:00 2001 From: dekken Date: Fri, 10 Nov 2023 16:07:44 +0100 Subject: [PATCH] try codeql --- .github/codeql-config.yml | 9 +++++ .github/workflows/cmake_macos.yml | 4 +++ .github/workflows/cmake_ubuntu.yml | 4 +++ .github/workflows/codeql.yml | 58 ++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 .github/codeql-config.yml create mode 100644 .github/workflows/codeql.yml diff --git a/.github/codeql-config.yml b/.github/codeql-config.yml new file mode 100644 index 000000000..980f59b6a --- /dev/null +++ b/.github/codeql-config.yml @@ -0,0 +1,9 @@ +# only for python/non-compiled languages + +name: "CodeQL config" +paths: + - pyphare + - src +paths-ignore: + - subprojects/ + - tests/ diff --git a/.github/workflows/cmake_macos.yml b/.github/workflows/cmake_macos.yml index daa602b1c..9b7741231 100644 --- a/.github/workflows/cmake_macos.yml +++ b/.github/workflows/cmake_macos.yml @@ -1,5 +1,9 @@ name: CMake MacOS +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + on: pull_request: workflow_dispatch: diff --git a/.github/workflows/cmake_ubuntu.yml b/.github/workflows/cmake_ubuntu.yml index ef43bc642..c8811d452 100644 --- a/.github/workflows/cmake_ubuntu.yml +++ b/.github/workflows/cmake_ubuntu.yml @@ -1,5 +1,9 @@ name: CMake Ubuntu +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + on: pull_request: workflow_dispatch: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..5aba48018 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,58 @@ +name: "CodeQL" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: "42 19 * * 4" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + container: ghcr.io/pharchive/phare_dep/ubuntu:22.04 + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ python, cpp ] + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Configure (cpp) + if: ${{ matrix.language == 'cpp' }} + run: mkdir build; cd build; cmake .. + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + config-file: ./.github/codeql-config.yml + languages: ${{ matrix.language }} + queries: +security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + if: ${{ matrix.language == 'python' }} + + - name: Build cpp + if: ${{ matrix.language == 'cpp' }} + run: cd build; make + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{ matrix.language }}"