1
0
mirror of https://github.com/microsoft/DirectXMath synced 2024-11-08 13:40:09 +00:00

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

This commit is contained in:
Chuck Walbourn 2024-07-29 20:15:54 -07:00 committed by GitHub
parent 6433b53910
commit ca317b6b87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 524 additions and 59 deletions

63
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,63 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkID=615560
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- 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: Clone test repository
uses: actions/checkout@v4
with:
repository: walbourn/directxmathtest
path: Tests
ref: main
- 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: ./Tests/headertest
run: cmake --preset=x64-Debug
- name: 'Build'
working-directory: ./Tests/headertest
run: cmake --build out\build\x64-Debug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:c-cpp"

91
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,91 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkID=615560
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: Clone test repository
uses: actions/checkout@v4
with:
repository: walbourn/directxmathtest
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 }}
- name: 'Build'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

62
.github/workflows/msbuild.yml vendored Normal file
View File

@ -0,0 +1,62 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkID=615560
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, 'NI Debug', 'NI Release']
platform: [x86, x64, ARM64]
exclude:
- vs: 2019
platform: ARM64
steps:
- uses: actions/checkout@v4
- name: Clone test repository
uses: actions/checkout@v4
with:
repository: walbourn/directxmathtest
path: Tests
ref: main
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build math3
working-directory: ${{ github.workspace }}/Tests/math3
run: msbuild /m /p:Configuration="${{ matrix.build_type }}" /p:Platform=${{ matrix.platform }} ./math3_${{ matrix.vs }}.sln
- if: (matrix.build_type == 'Debug') || (matrix.build_type == 'Release')
name: Build shmath
working-directory: ${{ github.workspace }}/Tests/shmath
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./shmath_${{ matrix.vs }}.sln
- if: (matrix.build_type == 'Debug') || (matrix.build_type == 'Release')
name: Build xdsp
working-directory: ${{ github.workspace }}/Tests/xdsp
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./XDSPTest_${{ matrix.vs }}.sln

117
.github/workflows/msbuildex.yml vendored Normal file
View File

@ -0,0 +1,117 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkID=615560
name: 'MSBuild (Extended)'
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:
include:
- vs: 2019
platform: x86
build_type: 'AVX Debug'
- vs: 2019
platform: x64
build_type: 'AVX Debug'
- vs: 2022
platform: x86
build_type: 'AVX Debug'
- vs: 2022
platform: x64
build_type: 'AVX Debug'
- vs: 2019
platform: x86
build_type: 'AVX2 Debug'
- vs: 2019
platform: x64
build_type: 'AVX2 Debug'
- vs: 2022
platform: x86
build_type: 'AVX2 Debug'
- vs: 2022
platform: x64
build_type: 'AVX2 Debug'
- vs: 2019
platform: x86
build_type: 'x87 Debug'
- vs: 2022
platform: x86
build_type: 'x87 Debug'
- vs: 2019
platform: x86
build_type: 'AVX Release'
- vs: 2019
platform: x64
build_type: 'AVX Release'
- vs: 2022
platform: x86
build_type: 'AVX Release'
- vs: 2022
platform: x64
build_type: 'AVX Release'
- vs: 2019
platform: x86
build_type: 'AVX2 Release'
- vs: 2019
platform: x64
build_type: 'AVX2 Release'
- vs: 2022
platform: x86
build_type: 'AVX2 Release'
- vs: 2022
platform: x64
build_type: 'AVX2 Release'
- vs: 2019
platform: x86
build_type: 'x87 Release'
- vs: 2022
platform: x86
build_type: 'x87 Release'
steps:
- uses: actions/checkout@v4
- name: Clone test repository
uses: actions/checkout@v4
with:
repository: walbourn/directxmathtest
path: Tests
ref: main
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build math3
working-directory: ${{ github.workspace }}/Tests/math3
run: msbuild /m /p:Configuration="${{ matrix.build_type }}" /p:Platform=${{ matrix.platform }} ./math3_${{ matrix.vs }}.sln
- if: (matrix.build_type == 'Debug') || (matrix.build_type == 'Release')
name: Build shmath
working-directory: ${{ github.workspace }}/Tests/shmath
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./shmath_${{ matrix.vs }}.sln
- if: (matrix.build_type == 'Debug') || (matrix.build_type == 'Release')
name: Build xdsp
working-directory: ${{ github.workspace }}/Tests/xdsp
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./XDSPTest_${{ matrix.vs }}.sln

60
.github/workflows/msvc.yml vendored Normal file
View File

@ -0,0 +1,60 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkID=615560
name: Microsoft C++ Code Analysis
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.yml
schedule:
- cron: '34 20 * * 6'
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: Clone test repository
uses: actions/checkout@v4
with:
repository: walbourn/directxmathtest
path: Tests
ref: main
- name: Configure CMake
working-directory: ./Tests/headertest
run: cmake -B out
- name: Initialize MSVC Code Analysis
uses: microsoft/msvc-code-analysis-action@v0.1.1
id: run-analysis
with:
cmakeBuildDirectory: ./Tests/headertest/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 }}

98
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,98 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkID=615560
name: 'CTest (Windows)'
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.yml
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/directxmathtest
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
- name: 'Build'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}
- if: (matrix.build_type == 'x64-Release') || (matrix.build_type == 'x86-Release')
timeout-minutes: 10
name: 'Test'
working-directory: ${{ github.workspace }}
run: ctest --preset=${{ matrix.build_type }}

View File

@ -175,6 +175,8 @@
{ "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" },

View File

@ -3,7 +3,7 @@
#
# http://go.microsoft.com/fwlink/?LinkID=615560
# Builds the library and test suite using CMake.
# Builds the library and test suite using CMake with VS Generator (GitHub Actions covers Ninja)
schedules:
- cron: "0 0 * * *"

View File

@ -3,7 +3,7 @@
#
# http://go.microsoft.com/fwlink/?LinkID=615560
# Builds the library and test suite using CMake.
# Builds the library and test suite using CMake using VS Generator (GitHub Actions covers Ninja).
schedules:
- cron: "0 0 * * *"
@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
pr:
@ -30,6 +31,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
resources:

View File

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

View File

@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
pr:
@ -30,6 +31,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
drafts: false

View File

@ -20,6 +20,7 @@ trigger:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
pr:
@ -30,6 +31,7 @@ pr:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
drafts: false

View File

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

View File

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