Skip to content

Commit 40ef3ce

Browse files
committed
Update codeql run for successful build
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
1 parent 5b0fbe7 commit 40ef3ce

1 file changed

Lines changed: 68 additions & 51 deletions

File tree

Lines changed: 68 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,86 @@
1-
######################################################################################
2-
# #
3-
# If you're looking for instructions on how to build this under windows go to #
4-
#https://github.com/openzfsonwindows/openzfs/blob/windows/module/os/windows/README.md#
5-
# #
6-
######################################################################################
7-
8-
name: "CodeQL windows"
1+
name: CodeQL Windows
92

103
on:
114
push:
5+
branches:
6+
- zfs-Windows-*-release
7+
tags-ignore:
8+
- '*'
129
pull_request:
13-
14-
env:
15-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
16-
BUILD_TYPE: Debug
10+
branches:
11+
- zfs-Windows-*-release
12+
workflow_dispatch:
1713

1814
jobs:
1915
analyze:
20-
name: Analyze
21-
timeout-minutes: 120
22-
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
23-
# You can convert this to a matrix build if you need cross-platform coverage.
24-
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
2516
runs-on: windows-latest
2617
permissions:
27-
actions: read
28-
contents: read
29-
security-events: write
18+
actions: read
19+
contents: read
20+
security-events: write
3021

3122
steps:
32-
- uses: ilammy/msvc-dev-cmd@v1
23+
- uses: ilammy/msvc-dev-cmd@v1
24+
25+
- uses: actions/checkout@v5
26+
with:
27+
fetch-depth: 0
28+
submodules: recursive
29+
30+
- uses: actions/checkout@v5
31+
with:
32+
repository: openzfsonwindows/openssl
33+
ref: openssl-3.5.5
34+
path: openssl
35+
36+
- name: Install WDK via NuGet
37+
shell: pwsh
38+
run: |
39+
nuget install Microsoft.Windows.WDK.x64 `
40+
-Version 10.0.26100.6584 `
41+
-OutputDirectory "${{ github.workspace }}\packages" `
42+
-Source https://api.nuget.org/v3/index.json
43+
44+
- name: Set WDK and SDK roots
45+
shell: pwsh
46+
run: |
47+
$wdk = Get-ChildItem "${{ github.workspace }}\packages" -Directory |
48+
Where-Object { $_.Name -like "Microsoft.Windows.WDK.x64.*" } |
49+
Sort-Object Name -Descending |
50+
Select-Object -First 1
3351
34-
- uses: actions/checkout@v3
35-
with:
36-
#repository: openzfsonwindows/openzfs
37-
fetch-depth: 0
52+
$sdk = Get-ChildItem "${{ github.workspace }}\packages" -Directory |
53+
Where-Object { $_.Name -like "Microsoft.Windows.SDK.CPP.*" -and $_.Name -notlike "*.x64.*" } |
54+
Sort-Object Name -Descending |
55+
Select-Object -First 1
3856
39-
- name: Import signing certificate
40-
run: |
41-
$plaintextpwd = 'password1234'
42-
$pwd = ConvertTo-SecureString -String $plaintextpwd -Force -AsPlainText
43-
Import-PfxCertificate -FilePath ${{github.workspace}}/contrib/windows/TestCert/test_sign_cert_pass.pfx -CertStoreLocation Cert:\CurrentUser\My -Password $pwd -Exportable
57+
"WDKContentRoot=$($wdk.FullName)\c" | Out-File -FilePath $env:GITHUB_ENV -Append
58+
"WINSDK_NUGET_ROOT=$($sdk.FullName)\c" | Out-File -FilePath $env:GITHUB_ENV -Append
4459
45-
- name: Checkout openssl
46-
uses: actions/checkout@v3
47-
with:
48-
repository: andrewc12/openssl # optional, default is ${{ github.repository }}
49-
path: openssl # optional
60+
- name: Initialize CodeQL
61+
uses: github/codeql-action/init@v3
62+
with:
63+
languages: c-cpp
64+
build-mode: manual
5065

51-
# Initializes the CodeQL tools for scanning.
52-
- name: Initialize CodeQL
53-
uses: github/codeql-action/init@v2
54-
# Override language selection by uncommenting this and choosing your languages
55-
with:
56-
languages: cpp
66+
- name: Create test signing certificate
67+
shell: pwsh
68+
run: |
69+
# only if your build still needs signing during compile/link
5770
58-
- name: Configure CMake
59-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
60-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
61-
run: cmake -G "Ninja" -B ${{github.workspace}}/out/build/x64-Debug ${{github.workspace}} -DOPENSSL_ROOT_DIR=${{github.workspace}}/openssl/ -DCRYPTO_STATIC_TEST=${{github.workspace}}/openssl/lib/VC/static/libcrypto64MTd.lib -DLIB_EAY_DEBUG=${{github.workspace}}/openssl/lib/VC/static/libcrypto64MTd.lib -DLIB_EAY_RELEASE=${{github.workspace}}/openssl/lib/VC/static/libcrypto64MT.lib -DOPENSSL_INCLUDE_DIR=${{github.workspace}}/openssl/include -DSSL_EAY_DEBUG=${{github.workspace}}/openssl/lib/VC/static/libssl64MTd.lib -DSSL_EAY_RELEASE=${{github.workspace}}/openssl/lib/VC/static/libssl64MT.lib
71+
- name: Configure CMake
72+
shell: pwsh
73+
run: |
74+
cmake -E env WDKContentRoot="$env:WDKContentRoot" WINSDK_NUGET_ROOT="$env:WINSDK_NUGET_ROOT" `
75+
cmake -G "Ninja" `
76+
-B "${{ github.workspace }}/out/build/x64-Debug" `
77+
"${{ github.workspace }}" `
78+
...
6279
63-
- name: Build
64-
working-directory: ${{github.workspace}}/out/build/x64-Debug
65-
# Build your program with the given configuration
66-
run: cmake --build ${{github.workspace}}/out/build/x64-Debug
80+
- name: Build
81+
shell: pwsh
82+
run: |
83+
cmake --build "${{ github.workspace }}/out/build/x64-Debug" --parallel
6784
68-
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@v2
85+
- name: Analyze
86+
uses: github/codeql-action/analyze@v3

0 commit comments

Comments
 (0)