diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..d100c2d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,69 @@ +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '43 3 * * 0' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + timeout-minutes: 360 + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'cpp', 'csharp' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + queries: security-extended,security-and-quality + + - name: Setup .NET (for C# analysis) + if: matrix.language == 'csharp' + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Build C# + if: matrix.language == 'csharp' + run: | + cd csharp + dotnet restore + dotnet build -c Release + + - name: Install dependencies (for C++ analysis) + if: matrix.language == 'cpp' + run: | + sudo apt-get update + sudo apt-get install -y cmake build-essential + + - name: Build C++ + if: matrix.language == 'cpp' + run: | + cd cpp + mkdir -p build + cd build + cmake .. + make + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/README.md b/README.md index f24c3db..67ecbb5 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/93857535a2214ba9b512e1a88787d461)](https://app.codacy.com/gh/linksplatform/Interfaces?utm_source=github.com&utm_medium=referral&utm_content=linksplatform/Interfaces&utm_campaign=Badge_Grade_Settings) [![CodeFactor](https://www.codefactor.io/repository/github/linksplatform/interfaces/badge)](https://www.codefactor.io/repository/github/linksplatform/interfaces) +[![CodeQL](https://github.com/linksplatform/Interfaces/actions/workflows/codeql.yml/badge.svg)](https://github.com/linksplatform/Interfaces/actions/workflows/codeql.yml) | [![Actions Status](https://github.com/linksplatform/Interfaces/workflows/deploy-cpp/badge.svg)](https://github.com/linksplatform/Interfaces/actions?workflow=deploy-cpp) | [![NuGet Version and Downloads count](https://img.shields.io/nuget/v/Platform.Interfaces.TemplateLibrary?label=nuget&style=flat)](https://www.nuget.org/packages/Platform.Interfaces.TemplateLibrary) [![ConanCenter package](https://repology.org/badge/version-for-repo/conancenter/platform.interfaces.svg)](https://conan.io/center/platform.interfaces) | __C++__ | |-|-|-|