Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GitHub Actions for build and security analysis #461

Merged
merged 16 commits into from
Jul 30, 2024
Merged
61 changes: 61 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248929

name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.yml
schedule:
- cron: '31 2 * * 5'

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"
89 changes: 89 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248929

name: 'CMake (Windows)'

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- 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-Win10
arch: amd64_arm64
- os: windows-2022
build_type: arm64-Release-Win10
arch: amd64_arm64
- os: windows-2022
build_type: arm64ec-Debug-Win10
arch: amd64_arm64
- os: windows-2022
build_type: arm64ec-Release-Win10
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 }}
69 changes: 69 additions & 0 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248929

name: Microsoft C++ Code Analysis

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.yml
schedule:
- cron: '25 15 * * 5'

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: 'Build Shaders'
shell: cmd
working-directory: ./Src/Shaders
run: CompileShaders.cmd
env:
CompileShadersOutput: ${{ github.workspace }}/out/Shaders/Compiled

- name: Initialize MSVC Code Analysis
uses: microsoft/[email protected]
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 }}
2 changes: 2 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@
{ "name": "x86-Release" , "configurePreset": "x86-Release" },
{ "name": "arm64-Debug" , "configurePreset": "arm64-Debug-Win10" },
{ "name": "arm64-Release", "configurePreset": "arm64-Release-Win10" },
{ "name": "arm64ec-Debug" , "configurePreset": "arm64ec-Debug-Win10" },
{ "name": "arm64ec-Release", "configurePreset": "arm64ec-Release-Win10" },

{ "name": "x64-Debug-Win7" , "configurePreset": "x64-Debug-Win7" },
{ "name": "x64-Release-Win7" , "configurePreset": "x64-Release-Win7" },
Expand Down
2 changes: 2 additions & 0 deletions build/DirectXTK-GitHub-CMake-Dev17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.json
Expand All @@ -35,6 +36,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.json
Expand Down
2 changes: 2 additions & 0 deletions build/DirectXTK-GitHub-CMake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.json
Expand All @@ -35,6 +36,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.json
Expand Down
2 changes: 2 additions & 0 deletions build/DirectXTK-GitHub-Dev17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ trigger:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
Expand All @@ -39,6 +40,7 @@ pr:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
Expand Down
2 changes: 2 additions & 0 deletions build/DirectXTK-GitHub-GDK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ trigger:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
Expand All @@ -39,6 +40,7 @@ pr:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
Expand Down
2 changes: 2 additions & 0 deletions build/DirectXTK-GitHub-MinGW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.json
Expand All @@ -35,6 +36,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.json
Expand Down
2 changes: 2 additions & 0 deletions build/DirectXTK-GitHub-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ trigger:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
Expand All @@ -39,6 +40,7 @@ pr:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
Expand Down
2 changes: 2 additions & 0 deletions build/DirectXTK-GitHub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ trigger:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
Expand All @@ -39,6 +40,7 @@ pr:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
Expand Down
Loading