1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-23 04:50:06 +00:00

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

This commit is contained in:
Chuck Walbourn 2024-07-29 20:13:36 -07:00 committed by GitHub
parent 87ec5d5610
commit 78ca9628e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 442 additions and 115 deletions

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

@ -0,0 +1,61 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248926
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: '43 3 * * 3'
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"

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

@ -0,0 +1,99 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248926
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
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 vendored Normal file
View File

@ -0,0 +1,62 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248926
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 }} ./DirectXTex_Desktop_${{ matrix.vs }}.sln
- name: 'Build (Windows 10)'
working-directory: ${{ github.workspace }}
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXTex_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 }} ./DirectXTex_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 }} ./DirectXTex_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 }} ./DirectXTex_Desktop_${{ matrix.vs }}_Win10.sln

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

@ -0,0 +1,76 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248926
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: '41 16 * * 1'
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 (BC)'
shell: cmd
working-directory: ./DirectXTex/Shaders
run: CompileShaders.cmd
env:
CompileShadersOutput: ${{ github.workspace }}/out/Shaders/Compiled
- name: 'Build Shaders (DDSVIEW)'
shell: cmd
working-directory: ./DDSView
run: hlsl.cmd
env:
CompileShadersOutput: ${{ github.workspace }}/out/Shaders/Compiled
- 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 }}

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

@ -0,0 +1,100 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248926
name: 'CTest (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
env:
DIRECTXTEX_MEDIA_PATH: ${{ github.workspace }}/Media
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
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/directxtextest
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 -DBUILD_SAMPLE=OFF
- name: 'Build'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

View File

@ -240,12 +240,12 @@
"hidden": true
},
{ "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" } },
@ -347,12 +347,12 @@
{ "name": "x64-Fuzzing" , "description": "MSVC for x64 (Release) with ASan", "inherits": [ "base", "x64", "Release", "MSVC", "Fuzzing" ] }
],
"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" },

View File

@ -31,6 +31,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>

View File

@ -32,6 +32,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>

View File

@ -31,6 +31,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>

View File

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

View File

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

View File

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

View File

@ -12,44 +12,15 @@ schedules:
include:
- main
trigger:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
# 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/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
drafts: false
include:
- build/DirectXTex-GitHub-Dev17.yml
resources:
repositories:

View File

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

View File

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

View File

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

View File

@ -12,43 +12,15 @@ schedules:
include:
- main
trigger:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
# 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/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
drafts: false
include:
- build/DirectXTex-GitHub-Test.yml
resources:
repositories:

View File

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

View File

@ -6,50 +6,21 @@
# Builds the library for Windows Desktop and UWP.
schedules:
- cron: "0 3 * * *"
- cron: "5 3 * * *"
displayName: 'Nightly build'
branches:
include:
- main
trigger:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
# 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/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
drafts: false
include:
- build/DirectXTex-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: