Added GitHub Actions for build and security analysis (#145)

This commit is contained in:
Chuck Walbourn 2024-07-29 20:12:31 -07:00 коммит произвёл GitHub
Родитель afe8ba249a
Коммит fac97a899b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
16 изменённых файлов: 426 добавлений и 92 удалений

60
.github/workflows/codeql.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,60 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# https://go.microsoft.com/fwlink/?LinkID=324981
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.yml
schedule:
- cron: '34 18 * * 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"

98
.github/workflows/main.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,98 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# https://go.microsoft.com/fwlink/?LinkID=324981
name: 'CMake (Windows)'
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- 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
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 }}
- if: matrix.arch != 'amd64_arm64'
name: 'Configure CMake (Spectre)'
working-directory: ${{ github.workspace }}
run: cmake --preset=${{ matrix.build_type }} -DENABLE_SPECTRE_MITIGATION=ON
- if: matrix.arch != 'amd64_arm64'
name: 'Build (Spectre)'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

62
.github/workflows/msbuild.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,62 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# https://go.microsoft.com/fwlink/?LinkID=324981
name: MSBuild
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*
permissions:
contents: read
jobs:
build:
runs-on: windows-${{ matrix.vs }}
strategy:
fail-fast: false
matrix:
vs: [2019, 2022]
build_type: [Debug, Release]
platform: [x86, x64, ARM64]
steps:
- uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- if: matrix.platform != 'ARM64'
name: Build
working-directory: ${{ github.workspace }}
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXMesh_Desktop_${{ matrix.vs }}.sln
- name: 'Build (Windows 10)'
working-directory: ${{ github.workspace }}
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXMesh_Desktop_${{ matrix.vs }}_Win10.sln
- if: matrix.vs == '2022'
name: 'Build (UWP)'
working-directory: ${{ github.workspace }}
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXMesh_Windows10_2022.sln
- if: matrix.platform != 'ARM64'
name: 'Build (Spectre)'
working-directory: ${{ github.workspace }}
run: msbuild /m /p:SpectreMitigation=Spectre /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXMesh_Desktop_${{ matrix.vs }}.sln
- if: matrix.platform != 'ARM64'
name: 'Build (Spectre Windows 10)'
working-directory: ${{ github.workspace }}
run: msbuild /m /p:SpectreMitigation=Spectre /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXMesh_Desktop_${{ matrix.vs }}_Win10.sln

57
.github/workflows/msvc.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,57 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# https://go.microsoft.com/fwlink/?LinkID=324981
name: Microsoft C++ Code Analysis
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.yml
schedule:
- cron: '31 18 * * 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
- 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 }}

99
.github/workflows/test.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,99 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# https://go.microsoft.com/fwlink/?LinkID=324981
name: 'CTest (Windows)'
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.yml
env:
DIRECTXMESH_MEDIA_PATH: ${{ github.workspace }}/Media
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 20
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: Clone test repository
uses: actions/checkout@v4
with:
repository: walbourn/directxmeshtest
path: Tests
ref: main
- 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 }} -DBUILD_TESTING=ON -DBUILD_TOOLS=OFF
- name: 'Build'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

Просмотреть файл

@ -183,12 +183,12 @@
}
},
{ "name": "x64-Debug" , "description": "MSVC for x64 (Debug) with DX12", "inherits": [ "base", "x64", "Debug", "MSVC" ] },
{ "name": "x64-Release" , "description": "MSVC for x64 (Release) with DX12", "inherits": [ "base", "x64", "Release", "MSVC" ] },
{ "name": "x86-Debug" , "description": "MSVC for x86 (Debug) with DX12", "inherits": [ "base", "x86", "Debug", "MSVC" ] },
{ "name": "x86-Release" , "description": "MSVC for x86 (Release) with DX12", "inherits": [ "base", "x86", "Release", "MSVC" ] },
{ "name": "arm64-Debug" , "description": "MSVC for ARM64 (Debug) with DX12", "inherits": [ "base", "ARM64", "Debug", "MSVC" ] },
{ "name": "arm64-Release", "description": "MSVC for ARM64 (Release) with DX12", "inherits": [ "base", "ARM64", "Release", "MSVC" ] },
{ "name": "x64-Debug" , "description": "MSVC for x64 (Debug) with DX12", "inherits": [ "base", "x64", "Debug", "MSVC" ] },
{ "name": "x64-Release" , "description": "MSVC for x64 (Release) with DX12", "inherits": [ "base", "x64", "Release", "MSVC" ] },
{ "name": "x86-Debug" , "description": "MSVC for x86 (Debug) with DX12", "inherits": [ "base", "x86", "Debug", "MSVC" ] },
{ "name": "x86-Release" , "description": "MSVC for x86 (Release) with DX12", "inherits": [ "base", "x86", "Release", "MSVC" ] },
{ "name": "arm64-Debug" , "description": "MSVC for ARM64 (Debug) with DX12", "inherits": [ "base", "ARM64", "Debug", "MSVC" ] },
{ "name": "arm64-Release" , "description": "MSVC for ARM64 (Release) with DX12", "inherits": [ "base", "ARM64", "Release", "MSVC" ] },
{ "name": "arm64ec-Debug" , "description": "MSVC for ARM64EC (Debug) with DX12", "inherits": [ "base", "ARM64EC", "Debug", "MSVC" ], "environment": { "CXXFLAGS": "/arm64EC" } },
{ "name": "arm64ec-Release", "description": "MSVC for ARM64EC (Release) with DX12", "inherits": [ "base", "ARM64EC", "Release", "MSVC" ], "environment": { "CXXFLAGS": "/arm64EC" } },
@ -210,12 +210,14 @@
{ "name": "x64-Debug-XboxOne" , "description": "MSVC for x64 (Debug) for Xbox One", "inherits": [ "base", "x64", "Debug", "MSVC", "XboxOne" ] },
{ "name": "x64-Release-XboxOne" , "description": "MSVC for x64 (Release) for Xbox One", "inherits": [ "base", "x64", "Release", "MSVC", "XboxOne" ] },
{ "name": "x64-Debug-VCPKG" , "description": "MSVC for x64 (Debug) using VCPKG", "inherits": [ "base", "x64", "Debug", "MSVC", "VCPKG" ] },
{ "name": "x64-Release-VCPKG" , "description": "MSVC for x64 (Release) using VCPKG", "inherits": [ "base", "x64", "Release", "MSVC", "VCPKG" ] },
{ "name": "x86-Debug-VCPKG" , "description": "MSVC for x86 (Debug) using VCPKG", "inherits": [ "base", "x86", "Debug", "MSVC", "VCPKG" ] },
{ "name": "x86-Release-VCPKG" , "description": "MSVC for x86 (Release) using VCPKG", "inherits": [ "base", "x86", "Release", "MSVC", "VCPKG" ] },
{ "name": "arm64-Debug-VCPKG" , "description": "MSVC for ARM64 (Debug) using VCPKG", "inherits": [ "base", "ARM64", "Debug", "MSVC", "VCPKG" ] },
{ "name": "arm64-Release-VCPKG", "description": "MSVC for ARM64 (Release) using VCPKG", "inherits": [ "base", "ARM64", "Release", "MSVC", "VCPKG" ] },
{ "name": "x64-Debug-VCPKG" , "description": "MSVC for x64 (Debug) using VCPKG", "inherits": [ "base", "x64", "Debug", "MSVC", "VCPKG" ] },
{ "name": "x64-Release-VCPKG" , "description": "MSVC for x64 (Release) using VCPKG", "inherits": [ "base", "x64", "Release", "MSVC", "VCPKG" ] },
{ "name": "x86-Debug-VCPKG" , "description": "MSVC for x86 (Debug) using VCPKG", "inherits": [ "base", "x86", "Debug", "MSVC", "VCPKG" ] },
{ "name": "x86-Release-VCPKG" , "description": "MSVC for x86 (Release) using VCPKG", "inherits": [ "base", "x86", "Release", "MSVC", "VCPKG" ] },
{ "name": "arm64-Debug-VCPKG" , "description": "MSVC for ARM64 (Debug) using VCPKG", "inherits": [ "base", "ARM64", "Debug", "MSVC", "VCPKG" ] },
{ "name": "arm64-Release-VCPKG" , "description": "MSVC for ARM64 (Release) using VCPKG", "inherits": [ "base", "ARM64", "Release", "MSVC", "VCPKG" ] },
{ "name": "arm64ec-Debug-VCPKG" , "description": "MSVC for ARM64EC (Debug) using VCPKG", "inherits": [ "base", "ARM64EC", "Debug", "MSVC", "VCPKG" ], "environment": { "CXXFLAGS": "/arm64EC" }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } },
{ "name": "arm64ec-Release-VCPKG", "description": "MSVC for ARM64EC (Release) using VCPKG", "inherits": [ "base", "ARM64EC", "Release", "MSVC", "VCPKG" ], "environment": { "CXXFLAGS": "/arm64EC" }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } },
{ "name": "x64-Debug-Clang" , "description": "Clang/LLVM for x64 (Debug) with DX12", "inherits": [ "base", "x64", "Debug", "Clang" ] },
{ "name": "x64-Release-Clang" , "description": "Clang/LLVM for x64 (Release) with DX12", "inherits": [ "base", "x64", "Release", "Clang" ] },
@ -259,12 +261,14 @@
{ "name": "arm64-Release-Linux", "description": "WSL Linux ARM64 (Release)", "inherits": [ "base", "ARM64", "Release", "VCPKG" ] }
],
"testPresets": [
{ "name": "x64-Debug" , "configurePreset": "x64-Debug" },
{ "name": "x64-Release" , "configurePreset": "x64-Release" },
{ "name": "x86-Debug" , "configurePreset": "x86-Debug" },
{ "name": "x86-Release" , "configurePreset": "x86-Release" },
{ "name": "arm64-Debug" , "configurePreset": "arm64-Debug" },
{ "name": "arm64-Release", "configurePreset": "arm64-Release" },
{ "name": "x64-Debug" , "configurePreset": "x64-Debug" },
{ "name": "x64-Release" , "configurePreset": "x64-Release" },
{ "name": "x86-Debug" , "configurePreset": "x86-Debug" },
{ "name": "x86-Release" , "configurePreset": "x86-Release" },
{ "name": "arm64-Debug" , "configurePreset": "arm64-Debug" },
{ "name": "arm64-Release" , "configurePreset": "arm64-Release" },
{ "name": "arm64ec-Debug" , "configurePreset": "arm64ec-Debug" },
{ "name": "arm64ec-Release", "configurePreset": "arm64ec-Release" },
{ "name": "x64-Debug-Clang" , "configurePreset": "x64-Debug-Clang" },
{ "name": "x64-Release-Clang" , "configurePreset": "x64-Release-Clang" },

Просмотреть файл

@ -3,7 +3,7 @@
#
# https://go.microsoft.com/fwlink/?LinkID=324981
# Builds the library using CMake.
# Builds the library using CMake with VS Generator (GitHub Actions covers Ninja).
schedules:
- cron: "0 4 * * *"
@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.props
@ -34,6 +35,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.props

Просмотреть файл

@ -3,7 +3,7 @@
#
# https://go.microsoft.com/fwlink/?LinkID=324981
# Builds the library using CMake.
# Builds the library using CMake with VS Generator (GitHub Actions covers Ninja).
schedules:
- cron: "0 4 * * *"
@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.props
@ -34,6 +35,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.props

Просмотреть файл

@ -12,22 +12,15 @@ schedules:
include:
- main
trigger:
# GitHub Actions handles MSBuild for CI/PR
trigger: none
pr:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1
- build/*.targets
include:
- build/DirectXMesh-GitHub-Dev17.yml
pr:
branches:
@ -38,6 +31,7 @@ pr:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd

Просмотреть файл

@ -23,6 +23,7 @@ trigger:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd
@ -38,6 +39,7 @@ pr:
- '*.md'
- LICENSE
- CMake*
- '.github/*'
- '.nuget/*'
- build/*.cmake
- build/*.cmd

Просмотреть файл

@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.props
@ -34,6 +35,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.props

Просмотреть файл

@ -12,8 +12,8 @@ schedules:
include:
- main
# GitHub Actions handles test suite for CI/PR
trigger: none
pr:
branches:
include:

Просмотреть файл

@ -12,40 +12,15 @@ schedules:
include:
- main
trigger:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1
- build/*.targets
# GitHub Actions handles test suite for CI/PR
trigger: none
pr:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1
- build/*.targets
drafts: false
include:
- build/DirectXMesh-GitHub-Test.yml
resources:
repositories:

Просмотреть файл

@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.props
@ -34,6 +35,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.props

Просмотреть файл

@ -12,40 +12,15 @@ schedules:
include:
- main
trigger:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1
- build/*.targets
# GitHub Actions handles MSBuild for CI/PR
trigger: none
pr:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1
- build/*.targets
drafts: false
include:
- build/DirectXMesh-GitHub.yml
resources:
repositories:

Просмотреть файл

@ -12,8 +12,8 @@ schedules:
include:
- main
# GitHub Actions handles CodeQL and PREFAST for CI/PR
trigger: none
pr:
branches:
include: