From 7af83f050b8a661c5a84cf6e6333b9ad0d79e1ca Mon Sep 17 00:00:00 2001 From: KircMax Date: Thu, 24 Oct 2024 13:27:26 +0200 Subject: [PATCH] Create codeql.yml (#42) * Create codeql.yml --- .github/workflows/codeql.yml | 67 ++++++++++++++++++++++++++++++++++++ README.md | 2 +- scripts/buildscript.ps1 | 4 +++ scripts/buildscript.sh | 1 + 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codeql.yml create mode 100644 scripts/buildscript.ps1 create mode 100644 scripts/buildscript.sh diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..8cb1bbf --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,67 @@ +# A CodeQL query for the S7-1500 WebserverApi Client library project +name: "CodeQL" + +on: + push: + branches: [ master, main, release/* ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master, main ] + paths: + - '**.cs' + schedule: + - cron: '40 7 * * 4' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze + runs-on: windows-2022 + + strategy: + fail-fast: false + matrix: + language: [ 'csharp' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.x' + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v2.0.0 + + + - name: Restore Packages + run: | + nuget restore "WebserverApi.sln" + - name: Build Solution + run: | + msbuild.exe "WebserverAPI.sln" /p:configuration="Release" /p:UseSharedCompilation=false + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 \ No newline at end of file diff --git a/README.md b/README.md index 50ad0a6..4894ba3 100644 --- a/README.md +++ b/README.md @@ -285,4 +285,4 @@ See Also: ## SIMATIC S7-1200: - SIMATIC S7-1200: https://new.siemens.com/global/en/products/automation/systems/industrial/plc/s7-1200.html - SIMATIC S7-1200 Manual: https://support.industry.siemens.com/cs/ch/en/view/109797241 -- SIMATIC S7-1200 Manual: https://support.industry.siemens.com/cs/us/en/view/91696622/45063671307 +- SIMATIC S7-1200 Manual: https://support.industry.siemens.com/cs/us/en/view/91696622/45063671307 \ No newline at end of file diff --git a/scripts/buildscript.ps1 b/scripts/buildscript.ps1 new file mode 100644 index 0000000..4257ee4 --- /dev/null +++ b/scripts/buildscript.ps1 @@ -0,0 +1,4 @@ +#$currentFolder = $MyInvocation.MyCommand.Path | Split-Path -Parent; +#$currentFolder = (Get-Location).Path +#echo $currentFolder +dotnet build ../src/Webserver.API/Webserver.API.csproj \ No newline at end of file diff --git a/scripts/buildscript.sh b/scripts/buildscript.sh new file mode 100644 index 0000000..0511e62 --- /dev/null +++ b/scripts/buildscript.sh @@ -0,0 +1 @@ +dotnet build ../src/Webserver.API/Webserver.API.csproj \ No newline at end of file