diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..0ad6218 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,56 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkId=271568 + +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - '*.md' + - LICENSE + - '.nuget/*' + - build/*.yml + schedule: + - cron: '21 22 * * 6' + +jobs: + analyze: + name: Analyze (C/C++) + runs-on: windows-latest + timeout-minutes: 360 + permissions: + security-events: write + packages: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: 'Install Ninja' + run: choco install ninja + + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: c-cpp + build-mode: manual + + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: cmake --preset=x64-Debug + + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\x64-Debug + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:c-cpp" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..6739c75 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,84 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkId=271568 + +name: 'CMake (Windows)' + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - '*.md' + - LICENSE + - '.nuget/*' + - build/*.yml + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [windows-2019, windows-2022] + build_type: [x64-Debug, x64-Release, x64-Debug-Clang, x64-Release-Clang] + arch: [amd64] + include: + - os: windows-2019 + build_type: x86-Debug + arch: amd64_x86 + - os: windows-2019 + build_type: x86-Release + arch: amd64_x86 + - os: windows-2019 + build_type: x86-Debug-Clang + arch: amd64_x86 + - os: windows-2019 + build_type: x86-Release-Clang + arch: amd64_x86 + - os: windows-2022 + build_type: x86-Debug + arch: amd64_x86 + - os: windows-2022 + build_type: x86-Release + arch: amd64_x86 + - os: windows-2022 + build_type: x86-Debug-Clang + arch: amd64_x86 + - os: windows-2022 + build_type: x86-Release-Clang + arch: amd64_x86 + - os: windows-2022 + build_type: arm64-Debug + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64-Release + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64ec-Debug + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64ec-Release + arch: amd64_arm64 + + steps: + - uses: actions/checkout@v4 + + - name: 'Install Ninja' + run: choco install ninja + + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: cmake --preset=${{ matrix.build_type }} + + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml new file mode 100644 index 0000000..68b3112 --- /dev/null +++ b/.github/workflows/msbuild.yml @@ -0,0 +1,52 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkId=271568 + +name: MSBuild + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - '*.md' + - LICENSE + - '.nuget/*' + - build/*.yml + +permissions: + contents: read + +jobs: + build: + runs-on: windows-${{ matrix.vs }} + + strategy: + fail-fast: false + + matrix: + vs: [2019, 2022] + build_type: [Debug, Release] + platformx: [Win32, x64] + + steps: + - uses: actions/checkout@v4 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Build + working-directory: ${{ github.workspace }} + run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platformx }} ./Effects11_${{ matrix.vs }}_Win10.sln + + - if: (matrix.vs == '2022' && matrix.platformx != 'Win32') + name: 'Build (UWP) x64' + working-directory: ${{ github.workspace }} + run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platformx }} ./Effects11_Windows10.sln + + - if: (matrix.vs == '2022' && matrix.platformx == 'Win32') + name: 'Build (UWP) x86' + working-directory: ${{ github.workspace }} + run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=x86 ./Effects11_Windows10.sln diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml new file mode 100644 index 0000000..719f8df --- /dev/null +++ b/.github/workflows/msvc.yml @@ -0,0 +1,57 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkId=271568 + +name: Microsoft C++ Code Analysis + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - '*.md' + - LICENSE + - '.nuget/*' + - build/*.yml + schedule: + - cron: '20 21 * * 2' + +permissions: + contents: read + +jobs: + analyze: + permissions: + contents: read + security-events: write + actions: read + name: Analyze + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: amd64 + + - name: Configure CMake + working-directory: ${{ github.workspace }} + run: cmake -B out -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON + + - name: Initialize MSVC Code Analysis + uses: microsoft/msvc-code-analysis-action@v0.1.1 + id: run-analysis + with: + cmakeBuildDirectory: ./out + buildConfiguration: Debug + ruleset: NativeRecommendedRules.ruleset + + # Upload SARIF file to GitHub Code Scanning Alerts + - name: Upload SARIF to GitHub + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: ${{ steps.run-analysis.outputs.sarif }} diff --git a/build/FX11-GitHub-CMake-Dev17.yml b/build/FX11-GitHub-CMake-Dev17.yml index 36f2934..0443a8b 100644 --- a/build/FX11-GitHub-CMake-Dev17.yml +++ b/build/FX11-GitHub-CMake-Dev17.yml @@ -3,7 +3,7 @@ # # http://go.microsoft.com/fwlink/?LinkId=271568 -# Builds the library using CMake. +# Builds the library using CMake with VS Generator (GitHub Actions covers Ninja). trigger: branches: @@ -135,178 +135,3 @@ jobs: inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: --build out7 -v --config RelWithDebInfo - - -- job: CMAKE_BUILD_X64 - displayName: 'CMake for X64' - timeoutInMinutes: 60 - workspace: - clean: all - steps: - - checkout: self - clean: true - fetchTags: false - - task: CmdLine@2 - displayName: Setup environment for CMake to use VS - inputs: - script: | - call "$(VC_PATH)\Auxiliary\Build\vcvars64.bat" - echo ##vso[task.setvariable variable=WindowsSdkVerBinPath;]%WindowsSdkVerBinPath% - echo ##vso[task.prependpath]%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja - echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin - echo ##vso[task.prependpath]%WindowsSdkBinPath%x64 - echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64 - echo ##vso[task.prependpath]%VCToolsInstallDir%bin\Hostx64\x64 - echo ##vso[task.setvariable variable=EXTERNAL_INCLUDE;]%EXTERNAL_INCLUDE% - echo ##vso[task.setvariable variable=INCLUDE;]%INCLUDE% - echo ##vso[task.setvariable variable=LIB;]%LIB% - - - task: CMake@1 - displayName: CMake (MSVC; x64-Debug) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=x64-Debug - - task: CMake@1 - displayName: CMake (MSVC; x64-Debug) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/x64-Debug -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (MSVC; x64-Release) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=x64-Release - - task: CMake@1 - displayName: CMake (MSVC; x64-Release) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/x64-Release -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (clang/LLVM; x64-Debug) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=x64-Debug-Clang - - task: CMake@1 - displayName: CMake (clang/LLVM; x64-Debug) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/x64-Debug-Clang -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (clang/LLVM; x64-Release) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=x64-Release-Clang - - task: CMake@1 - displayName: CMake (clang/LLVM; x64-Release) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/x64-Release-Clang -v - -- job: CMAKE_BUILD_ARM64 - displayName: 'CMake for ARM64' - timeoutInMinutes: 60 - workspace: - clean: all - steps: - - checkout: self - clean: true - fetchTags: false - - task: CmdLine@2 - displayName: Setup environment for CMake to use VS - inputs: - script: | - call "$(VC_PATH)\Auxiliary\Build\vcvarsamd64_arm64.bat" - echo ##vso[task.setvariable variable=WindowsSdkVerBinPath;]%WindowsSdkVerBinPath% - echo ##vso[task.prependpath]%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja - echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin - echo ##vso[task.prependpath]%WindowsSdkBinPath%x64 - echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64 - echo ##vso[task.prependpath]%VCToolsInstallDir%bin\Hostx64\arm64 - echo ##vso[task.setvariable variable=EXTERNAL_INCLUDE;]%EXTERNAL_INCLUDE% - echo ##vso[task.setvariable variable=INCLUDE;]%INCLUDE% - echo ##vso[task.setvariable variable=LIB;]%LIB% - - - task: CMake@1 - displayName: CMake (MSVC; arm64-Debug) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=arm64-Debug - - task: CMake@1 - displayName: CMake (MSVC; arm64-Debug) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/arm64-Debug -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (MSVC; arm64-Release) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=arm64-Release - - task: CMake@1 - displayName: CMake (MSVC; arm64-Release) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/arm64-Release -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (clang/LLVM; arm64-Debug) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=arm64-Debug-Clang - - task: CMake@1 - displayName: CMake (clang/LLVM; arm64-Debug) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/arm64-Debug-Clang -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (clang/LLVM; arm64-Release) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=arm64-Release-Clang - - task: CMake@1 - displayName: CMake (clang/LLVM; arm64-Release) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/arm64-Release-Clang -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (MSVC; arm64ec-Debug) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=arm64ec-Debug - - task: CMake@1 - displayName: CMake (MSVC; arm64ec-Debug) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/arm64ec-Debug -v - - task: DeleteFiles@1 - inputs: - Contents: 'out' - - task: CMake@1 - displayName: CMake (MSVC; arm64ec-Release) Config - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --preset=arm64ec-Release - - task: CMake@1 - displayName: CMake (MSVC; arm64ec-Release) Build - inputs: - cwd: '$(Build.SourcesDirectory)' - cmakeArgs: --build out/build/arm64ec-Release -v diff --git a/build/FX11-GitHub-CMake.yml b/build/FX11-GitHub-CMake.yml index c9f04cf..378b90a 100644 --- a/build/FX11-GitHub-CMake.yml +++ b/build/FX11-GitHub-CMake.yml @@ -3,7 +3,7 @@ # # http://go.microsoft.com/fwlink/?LinkId=271568 -# Builds the library using CMake. +# Builds the library using CMake with VS Generator (GitHub Actions covers Ninja). trigger: branches: diff --git a/build/FX11-GitHub-Dev17.yml b/build/FX11-GitHub-Dev17.yml index 503ef53..5190d4f 100644 --- a/build/FX11-GitHub-Dev17.yml +++ b/build/FX11-GitHub-Dev17.yml @@ -5,32 +5,22 @@ # Builds the library for Windows Desktop. -trigger: +schedules: +- cron: "10 5 * * *" + displayName: 'Nightly build' branches: include: - main - paths: - exclude: - - '*.md' - - LICENSE - - '.github/*' - - CMake* - - build/*.cmake - - build/*.in +# GitHub Actions handles MSBuild for CI/PR +trigger: none pr: branches: include: - main paths: - exclude: - - '*.md' - - LICENSE - - '.github/*' - - CMake* - - build/*.cmake - - build/*.in - drafts: false + include: + - build/FX11-GitHub-Dev17.yml resources: repositories: diff --git a/build/FX11-GitHub.yml b/build/FX11-GitHub.yml index 022983e..c1c6ac9 100644 --- a/build/FX11-GitHub.yml +++ b/build/FX11-GitHub.yml @@ -5,32 +5,22 @@ # Builds the library for Windows Desktop. -trigger: +schedules: +- cron: "15 5 * * *" + displayName: 'Nightly build' branches: include: - main - paths: - exclude: - - '*.md' - - LICENSE - - '.github/*' - - CMake* - - build/*.cmake - - build/*.in +# GitHub Actions handles MSBuild for CI/PR +trigger: none pr: branches: include: - main paths: - exclude: - - '*.md' - - LICENSE - - '.github/*' - - CMake* - - build/*.cmake - - build/*.in - drafts: false + include: + - build/FX11-GitHub.yml resources: repositories: diff --git a/build/FX11-SDL.yml b/build/FX11-SDL.yml index 557eb0e..9188fa7 100644 --- a/build/FX11-SDL.yml +++ b/build/FX11-SDL.yml @@ -12,8 +12,8 @@ schedules: include: - main +# GitHub Actions handles CodeQL and PREFAST for CI/PR trigger: none - pr: branches: include: