Skip to content

Commit 78ca962

Browse files
authored
Added GitHub Actions for build and security analysis (#491)
1 parent 87ec5d5 commit 78ca962

20 files changed

+442
-115
lines changed

.github/workflows/codeql.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkId=248926
5+
6+
name: "CodeQL"
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
pull_request:
12+
branches: [ "main" ]
13+
paths-ignore:
14+
- '*.md'
15+
- LICENSE
16+
- '.nuget/*'
17+
- build/*.cmd
18+
- build/*.json
19+
- build/*.props
20+
- build/*.ps1
21+
- build/*.targets
22+
- build/*.yml
23+
schedule:
24+
- cron: '43 3 * * 3'
25+
26+
jobs:
27+
analyze:
28+
name: Analyze (C/C++)
29+
runs-on: windows-latest
30+
timeout-minutes: 360
31+
permissions:
32+
security-events: write
33+
packages: read
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
39+
- name: 'Install Ninja'
40+
run: choco install ninja
41+
42+
- uses: ilammy/msvc-dev-cmd@v1
43+
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v3
46+
with:
47+
languages: c-cpp
48+
build-mode: manual
49+
50+
- name: 'Configure CMake'
51+
working-directory: ${{ github.workspace }}
52+
run: cmake --preset=x64-Debug
53+
54+
- name: 'Build'
55+
working-directory: ${{ github.workspace }}
56+
run: cmake --build out\build\x64-Debug
57+
58+
- name: Perform CodeQL Analysis
59+
uses: github/codeql-action/analyze@v3
60+
with:
61+
category: "/language:c-cpp"

.github/workflows/main.yml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkId=248926
5+
6+
name: 'CMake (Windows)'
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
pull_request:
12+
branches: [ "main" ]
13+
paths-ignore:
14+
- '*.md'
15+
- LICENSE
16+
- '.nuget/*'
17+
- build/*.cmd
18+
- build/*.json
19+
- build/*.props
20+
- build/*.ps1
21+
- build/*.targets
22+
- build/*.yml
23+
24+
jobs:
25+
build:
26+
runs-on: ${{ matrix.os }}
27+
28+
strategy:
29+
fail-fast: false
30+
31+
matrix:
32+
os: [windows-2019, windows-2022]
33+
build_type: [x64-Debug, x64-Release, x64-Debug-Clang, x64-Release-Clang]
34+
arch: [amd64]
35+
include:
36+
- os: windows-2019
37+
build_type: x86-Debug
38+
arch: amd64_x86
39+
- os: windows-2019
40+
build_type: x86-Release
41+
arch: amd64_x86
42+
- os: windows-2019
43+
build_type: x86-Debug-Clang
44+
arch: amd64_x86
45+
- os: windows-2019
46+
build_type: x86-Release-Clang
47+
arch: amd64_x86
48+
- os: windows-2022
49+
build_type: x86-Debug
50+
arch: amd64_x86
51+
- os: windows-2022
52+
build_type: x86-Release
53+
arch: amd64_x86
54+
- os: windows-2022
55+
build_type: x86-Debug-Clang
56+
arch: amd64_x86
57+
- os: windows-2022
58+
build_type: x86-Release-Clang
59+
arch: amd64_x86
60+
- os: windows-2022
61+
build_type: arm64-Debug
62+
arch: amd64_arm64
63+
- os: windows-2022
64+
build_type: arm64-Release
65+
arch: amd64_arm64
66+
- os: windows-2022
67+
build_type: arm64ec-Debug
68+
arch: amd64_arm64
69+
- os: windows-2022
70+
build_type: arm64ec-Release
71+
arch: amd64_arm64
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: 'Install Ninja'
77+
run: choco install ninja
78+
79+
- uses: ilammy/msvc-dev-cmd@v1
80+
with:
81+
arch: ${{ matrix.arch }}
82+
83+
- name: 'Configure CMake'
84+
working-directory: ${{ github.workspace }}
85+
run: cmake --preset=${{ matrix.build_type }}
86+
87+
- name: 'Build'
88+
working-directory: ${{ github.workspace }}
89+
run: cmake --build out\build\${{ matrix.build_type }}
90+
91+
- if: matrix.arch != 'amd64_arm64'
92+
name: 'Configure CMake (Spectre)'
93+
working-directory: ${{ github.workspace }}
94+
run: cmake --preset=${{ matrix.build_type }} -DENABLE_SPECTRE_MITIGATION=ON
95+
96+
- if: matrix.arch != 'amd64_arm64'
97+
name: 'Build (Spectre)'
98+
working-directory: ${{ github.workspace }}
99+
run: cmake --build out\build\${{ matrix.build_type }}

.github/workflows/msbuild.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkId=248926
5+
6+
name: MSBuild
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
pull_request:
12+
branches: [ "main" ]
13+
paths-ignore:
14+
- '*.md'
15+
- LICENSE
16+
- '.nuget/*'
17+
- build/*
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
build:
24+
runs-on: windows-${{ matrix.vs }}
25+
26+
strategy:
27+
fail-fast: false
28+
29+
matrix:
30+
vs: [2019, 2022]
31+
build_type: [Debug, Release]
32+
platform: [x86, x64, ARM64]
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Add MSBuild to PATH
38+
uses: microsoft/setup-msbuild@v2
39+
40+
- if: matrix.platform != 'ARM64'
41+
name: Build
42+
working-directory: ${{ github.workspace }}
43+
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXTex_Desktop_${{ matrix.vs }}.sln
44+
45+
- name: 'Build (Windows 10)'
46+
working-directory: ${{ github.workspace }}
47+
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXTex_Desktop_${{ matrix.vs }}_Win10.sln
48+
49+
- if: matrix.vs == '2022'
50+
name: 'Build (UWP)'
51+
working-directory: ${{ github.workspace }}
52+
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXTex_Windows10_2022.sln
53+
54+
- if: matrix.platform != 'ARM64'
55+
name: 'Build (Spectre)'
56+
working-directory: ${{ github.workspace }}
57+
run: msbuild /m /p:SpectreMitigation=Spectre /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXTex_Desktop_${{ matrix.vs }}.sln
58+
59+
- if: matrix.platform != 'ARM64'
60+
name: 'Build (Spectre Windows 10)'
61+
working-directory: ${{ github.workspace }}
62+
run: msbuild /m /p:SpectreMitigation=Spectre /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./DirectXTex_Desktop_${{ matrix.vs }}_Win10.sln

.github/workflows/msvc.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkId=248926
5+
6+
name: Microsoft C++ Code Analysis
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
pull_request:
12+
branches: [ "main" ]
13+
paths-ignore:
14+
- '*.md'
15+
- LICENSE
16+
- '.nuget/*'
17+
- build/*.cmd
18+
- build/*.json
19+
- build/*.props
20+
- build/*.ps1
21+
- build/*.targets
22+
- build/*.yml
23+
schedule:
24+
- cron: '41 16 * * 1'
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
analyze:
31+
permissions:
32+
contents: read
33+
security-events: write
34+
actions: read
35+
name: Analyze
36+
runs-on: windows-latest
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
42+
- uses: ilammy/msvc-dev-cmd@v1
43+
with:
44+
arch: amd64
45+
46+
- name: Configure CMake
47+
working-directory: ${{ github.workspace }}
48+
run: cmake -B out -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
49+
50+
- name: 'Build Shaders (BC)'
51+
shell: cmd
52+
working-directory: ./DirectXTex/Shaders
53+
run: CompileShaders.cmd
54+
env:
55+
CompileShadersOutput: ${{ github.workspace }}/out/Shaders/Compiled
56+
57+
- name: 'Build Shaders (DDSVIEW)'
58+
shell: cmd
59+
working-directory: ./DDSView
60+
run: hlsl.cmd
61+
env:
62+
CompileShadersOutput: ${{ github.workspace }}/out/Shaders/Compiled
63+
64+
- name: Initialize MSVC Code Analysis
65+
uses: microsoft/[email protected]
66+
id: run-analysis
67+
with:
68+
cmakeBuildDirectory: ./out
69+
buildConfiguration: Debug
70+
ruleset: NativeRecommendedRules.ruleset
71+
72+
# Upload SARIF file to GitHub Code Scanning Alerts
73+
- name: Upload SARIF to GitHub
74+
uses: github/codeql-action/upload-sarif@v3
75+
with:
76+
sarif_file: ${{ steps.run-analysis.outputs.sarif }}

0 commit comments

Comments
 (0)