1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-09 14:30:05 +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

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
# #
# http://go.microsoft.com/fwlink/?LinkId=248926 # 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: schedules:
- cron: "0 5 * * *" - cron: "0 5 * * *"
@ -20,6 +20,7 @@ trigger:
exclude: exclude:
- '*.md' - '*.md'
- LICENSE - LICENSE
- '.github/*'
- '.nuget/*' - '.nuget/*'
- build/*.cmd - build/*.cmd
- build/*.json - build/*.json
@ -35,6 +36,7 @@ pr:
exclude: exclude:
- '*.md' - '*.md'
- LICENSE - LICENSE
- '.github/*'
- '.nuget/*' - '.nuget/*'
- build/*.cmd - build/*.cmd
- build/*.json - build/*.json

View File

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

View File

@ -3,7 +3,7 @@
# #
# http://go.microsoft.com/fwlink/?LinkId=248926 # 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: schedules:
- cron: "0 5 * * *" - cron: "0 5 * * *"
@ -20,6 +20,7 @@ trigger:
exclude: exclude:
- '*.md' - '*.md'
- LICENSE - LICENSE
- '.github/*'
- '.nuget/*' - '.nuget/*'
- build/*.cmd - build/*.cmd
- build/*.json - build/*.json
@ -35,6 +36,7 @@ pr:
exclude: exclude:
- '*.md' - '*.md'
- LICENSE - LICENSE
- '.github/*'
- '.nuget/*' - '.nuget/*'
- build/*.cmd - build/*.cmd
- build/*.json - build/*.json

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,50 +6,21 @@
# Builds the library for Windows Desktop and UWP. # Builds the library for Windows Desktop and UWP.
schedules: schedules:
- cron: "0 3 * * *" - cron: "5 3 * * *"
displayName: 'Nightly build' displayName: 'Nightly build'
branches: branches:
include: include:
- main - main
trigger: # GitHub Actions handles MSBuild for CI/PR
branches: trigger: none
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
pr: pr:
branches: branches:
include: include:
- main - main
paths: paths:
exclude: include:
- '*.md' - build/DirectXTex-GitHub.yml
- LICENSE
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- Auxiliary/*
drafts: false
resources: resources:
repositories: repositories:

View File

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