Skip to content

Commit ca317b6

Browse files
authored
Added GitHub Actions for build and security analysis (#196)
1 parent 6433b53 commit ca317b6

14 files changed

+524
-59
lines changed

.github/workflows/codeql.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkID=615560
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/*.yml
18+
schedule:
19+
- cron: '34 18 * * 6'
20+
21+
jobs:
22+
analyze:
23+
name: Analyze (C/C++)
24+
runs-on: windows-latest
25+
timeout-minutes: 360
26+
permissions:
27+
security-events: write
28+
packages: read
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Clone test repository
35+
uses: actions/checkout@v4
36+
with:
37+
repository: walbourn/directxmathtest
38+
path: Tests
39+
ref: main
40+
41+
- name: 'Install Ninja'
42+
run: choco install ninja
43+
44+
- uses: ilammy/msvc-dev-cmd@v1
45+
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@v3
48+
with:
49+
languages: c-cpp
50+
build-mode: manual
51+
52+
- name: 'Configure CMake'
53+
working-directory: ./Tests/headertest
54+
run: cmake --preset=x64-Debug
55+
56+
- name: 'Build'
57+
working-directory: ./Tests/headertest
58+
run: cmake --build out\build\x64-Debug
59+
60+
- name: Perform CodeQL Analysis
61+
uses: github/codeql-action/analyze@v3
62+
with:
63+
category: "/language:c-cpp"

.github/workflows/main.yml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkID=615560
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/*.yml
18+
19+
jobs:
20+
build:
21+
runs-on: ${{ matrix.os }}
22+
23+
strategy:
24+
fail-fast: false
25+
26+
matrix:
27+
os: [windows-2019, windows-2022]
28+
build_type: [x64-Debug, x64-Release, x64-Debug-Clang, x64-Release-Clang]
29+
arch: [amd64]
30+
include:
31+
- os: windows-2019
32+
build_type: x86-Debug
33+
arch: amd64_x86
34+
- os: windows-2019
35+
build_type: x86-Release
36+
arch: amd64_x86
37+
- os: windows-2019
38+
build_type: x86-Debug-Clang
39+
arch: amd64_x86
40+
- os: windows-2019
41+
build_type: x86-Release-Clang
42+
arch: amd64_x86
43+
- os: windows-2022
44+
build_type: x86-Debug
45+
arch: amd64_x86
46+
- os: windows-2022
47+
build_type: x86-Release
48+
arch: amd64_x86
49+
- os: windows-2022
50+
build_type: x86-Debug-Clang
51+
arch: amd64_x86
52+
- os: windows-2022
53+
build_type: x86-Release-Clang
54+
arch: amd64_x86
55+
- os: windows-2022
56+
build_type: arm64-Debug
57+
arch: amd64_arm64
58+
- os: windows-2022
59+
build_type: arm64-Release
60+
arch: amd64_arm64
61+
- os: windows-2022
62+
build_type: arm64ec-Debug
63+
arch: amd64_arm64
64+
- os: windows-2022
65+
build_type: arm64ec-Release
66+
arch: amd64_arm64
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Clone test repository
72+
uses: actions/checkout@v4
73+
with:
74+
repository: walbourn/directxmathtest
75+
path: Tests
76+
ref: main
77+
78+
- name: 'Install Ninja'
79+
run: choco install ninja
80+
81+
- uses: ilammy/msvc-dev-cmd@v1
82+
with:
83+
arch: ${{ matrix.arch }}
84+
85+
- name: 'Configure CMake'
86+
working-directory: ${{ github.workspace }}
87+
run: cmake --preset=${{ matrix.build_type }}
88+
89+
- name: 'Build'
90+
working-directory: ${{ github.workspace }}
91+
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=615560
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, 'NI Debug', 'NI Release']
32+
platform: [x86, x64, ARM64]
33+
exclude:
34+
- vs: 2019
35+
platform: ARM64
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Clone test repository
41+
uses: actions/checkout@v4
42+
with:
43+
repository: walbourn/directxmathtest
44+
path: Tests
45+
ref: main
46+
47+
- name: Add MSBuild to PATH
48+
uses: microsoft/setup-msbuild@v2
49+
50+
- name: Build math3
51+
working-directory: ${{ github.workspace }}/Tests/math3
52+
run: msbuild /m /p:Configuration="${{ matrix.build_type }}" /p:Platform=${{ matrix.platform }} ./math3_${{ matrix.vs }}.sln
53+
54+
- if: (matrix.build_type == 'Debug') || (matrix.build_type == 'Release')
55+
name: Build shmath
56+
working-directory: ${{ github.workspace }}/Tests/shmath
57+
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./shmath_${{ matrix.vs }}.sln
58+
59+
- if: (matrix.build_type == 'Debug') || (matrix.build_type == 'Release')
60+
name: Build xdsp
61+
working-directory: ${{ github.workspace }}/Tests/xdsp
62+
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./XDSPTest_${{ matrix.vs }}.sln

.github/workflows/msbuildex.yml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkID=615560
5+
6+
name: 'MSBuild (Extended)'
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+
include:
31+
- vs: 2019
32+
platform: x86
33+
build_type: 'AVX Debug'
34+
- vs: 2019
35+
platform: x64
36+
build_type: 'AVX Debug'
37+
- vs: 2022
38+
platform: x86
39+
build_type: 'AVX Debug'
40+
- vs: 2022
41+
platform: x64
42+
build_type: 'AVX Debug'
43+
- vs: 2019
44+
platform: x86
45+
build_type: 'AVX2 Debug'
46+
- vs: 2019
47+
platform: x64
48+
build_type: 'AVX2 Debug'
49+
- vs: 2022
50+
platform: x86
51+
build_type: 'AVX2 Debug'
52+
- vs: 2022
53+
platform: x64
54+
build_type: 'AVX2 Debug'
55+
- vs: 2019
56+
platform: x86
57+
build_type: 'x87 Debug'
58+
- vs: 2022
59+
platform: x86
60+
build_type: 'x87 Debug'
61+
- vs: 2019
62+
platform: x86
63+
build_type: 'AVX Release'
64+
- vs: 2019
65+
platform: x64
66+
build_type: 'AVX Release'
67+
- vs: 2022
68+
platform: x86
69+
build_type: 'AVX Release'
70+
- vs: 2022
71+
platform: x64
72+
build_type: 'AVX Release'
73+
- vs: 2019
74+
platform: x86
75+
build_type: 'AVX2 Release'
76+
- vs: 2019
77+
platform: x64
78+
build_type: 'AVX2 Release'
79+
- vs: 2022
80+
platform: x86
81+
build_type: 'AVX2 Release'
82+
- vs: 2022
83+
platform: x64
84+
build_type: 'AVX2 Release'
85+
- vs: 2019
86+
platform: x86
87+
build_type: 'x87 Release'
88+
- vs: 2022
89+
platform: x86
90+
build_type: 'x87 Release'
91+
92+
steps:
93+
- uses: actions/checkout@v4
94+
95+
- name: Clone test repository
96+
uses: actions/checkout@v4
97+
with:
98+
repository: walbourn/directxmathtest
99+
path: Tests
100+
ref: main
101+
102+
- name: Add MSBuild to PATH
103+
uses: microsoft/setup-msbuild@v2
104+
105+
- name: Build math3
106+
working-directory: ${{ github.workspace }}/Tests/math3
107+
run: msbuild /m /p:Configuration="${{ matrix.build_type }}" /p:Platform=${{ matrix.platform }} ./math3_${{ matrix.vs }}.sln
108+
109+
- if: (matrix.build_type == 'Debug') || (matrix.build_type == 'Release')
110+
name: Build shmath
111+
working-directory: ${{ github.workspace }}/Tests/shmath
112+
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./shmath_${{ matrix.vs }}.sln
113+
114+
- if: (matrix.build_type == 'Debug') || (matrix.build_type == 'Release')
115+
name: Build xdsp
116+
working-directory: ${{ github.workspace }}/Tests/xdsp
117+
run: msbuild /m /p:Configuration=${{ matrix.build_type }} /p:Platform=${{ matrix.platform }} ./XDSPTest_${{ matrix.vs }}.sln

.github/workflows/msvc.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkID=615560
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/*.yml
18+
schedule:
19+
- cron: '34 20 * * 6'
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
analyze:
26+
permissions:
27+
contents: read
28+
security-events: write
29+
actions: read
30+
name: Analyze
31+
runs-on: windows-latest
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
37+
- name: Clone test repository
38+
uses: actions/checkout@v4
39+
with:
40+
repository: walbourn/directxmathtest
41+
path: Tests
42+
ref: main
43+
44+
- name: Configure CMake
45+
working-directory: ./Tests/headertest
46+
run: cmake -B out
47+
48+
- name: Initialize MSVC Code Analysis
49+
uses: microsoft/[email protected]
50+
id: run-analysis
51+
with:
52+
cmakeBuildDirectory: ./Tests/headertest/out
53+
buildConfiguration: Debug
54+
ruleset: NativeRecommendedRules.ruleset
55+
56+
# Upload SARIF file to GitHub Code Scanning Alerts
57+
- name: Upload SARIF to GitHub
58+
uses: github/codeql-action/upload-sarif@v3
59+
with:
60+
sarif_file: ${{ steps.run-analysis.outputs.sarif }}

0 commit comments

Comments
 (0)