Skip to content

Commit ec64c5d

Browse files
committed
Testing: add GitHub action to test Windows Visual Studio non-FIPS build of IDE/WIN project
1 parent 0f5de75 commit ec64c5d

File tree

2 files changed

+92
-180
lines changed

2 files changed

+92
-180
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -6,184 +6,10 @@ on:
66
branches: [ '*' ]
77

88
jobs:
9-
# Oracle JDK (Linux, Mac)
10-
# Oracle JDK requires JAR to be signed for some classes to load/run
11-
# properly, for example KeyAgreement. These tests are commented out
12-
# here until we get a solution in place for CI JAR signing
13-
#linux-oracle:
14-
# strategy:
15-
# matrix:
16-
# os: [ 'ubuntu-latest', 'macos-latest' ]
17-
# jdk_version: [ '17', '21' ]
18-
# wolfssl_configure: [ '--enable-jni' ]
19-
# name: ${{ matrix.os }} (Oracle JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure}})
20-
# uses: ./.github/workflows/linux-common.yml
21-
# with:
22-
# os: ${{ matrix.os }}
23-
# jdk_distro: "oracle"
24-
# jdk_version: ${{ matrix.jdk_version }}
25-
# wolfssl_configure: ${{ matrix.wolfssl_configure }}
26-
27-
# Zulu JDK (Linux, Mac)
28-
linux-zulu:
29-
strategy:
30-
matrix:
31-
os: [ 'ubuntu-latest', 'macos-latest' ]
32-
jdk_version: [ '8', '11', '17', '21' ]
33-
wolfssl_configure: [ '--enable-jni' ]
34-
name: ${{ matrix.os }} (Zulu JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure}})
35-
uses: ./.github/workflows/linux-common.yml
36-
with:
37-
os: ${{ matrix.os }}
38-
jdk_distro: "zulu"
39-
jdk_version: ${{ matrix.jdk_version }}
40-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
41-
42-
# Corretto JDK (Linux, Mac)
43-
linux-corretto:
44-
strategy:
45-
matrix:
46-
os: [ 'ubuntu-latest', 'macos-latest' ]
47-
jdk_version: [ '8', '11', '17', '21' ]
48-
wolfssl_configure: [ '--enable-jni' ]
49-
name: ${{ matrix.os }} (Corretto JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure}})
50-
uses: ./.github/workflows/linux-common.yml
51-
with:
52-
os: ${{ matrix.os }}
53-
jdk_distro: "corretto"
54-
jdk_version: ${{ matrix.jdk_version }}
55-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
56-
57-
# Temurin JDK (Linux, Mac)
58-
# JDK 8 seems to have been removed from Temurin macos, with 8 we see the error
59-
# Could not find satisfied version for SemVer '8'
60-
linux-temurin:
61-
strategy:
62-
matrix:
63-
os: [ 'ubuntu-latest', 'macos-latest' ]
64-
jdk_version: [ '11', '17', '21' ]
65-
wolfssl_configure: [ '--enable-jni' ]
66-
name: ${{ matrix.os }} (Temurin JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure}})
67-
uses: ./.github/workflows/linux-common.yml
68-
with:
69-
os: ${{ matrix.os }}
70-
jdk_distro: "temurin"
71-
jdk_version: ${{ matrix.jdk_version }}
72-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
73-
74-
# Microsoft JDK (Linux, Mac)
75-
linux-microsoft:
76-
strategy:
77-
matrix:
78-
os: [ 'ubuntu-latest', 'macos-latest' ]
79-
jdk_version: [ '11.0.19', '17.0.7', '21.0.0' ]
80-
wolfssl_configure: [ '--enable-jni' ]
81-
name: ${{ matrix.os }} (Microsoft JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure}})
82-
uses: ./.github/workflows/linux-common.yml
83-
with:
84-
os: ${{ matrix.os }}
85-
jdk_distro: "microsoft"
86-
jdk_version: ${{ matrix.jdk_version }}
87-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
88-
89-
# -------------------- enable-all sanity checks -----------------------
90-
# Only check one Linux and Mac JDK version with --enable-jni --enable-all
91-
# as sanity. Using Zulu, but this can be expanded if needed.
92-
linux-zulu-all:
93-
strategy:
94-
matrix:
95-
os: [ 'ubuntu-latest', 'macos-latest' ]
96-
jdk_version: [ '11' ]
97-
wolfssl_configure: [ '--enable-jni --enable-all' ]
98-
name: ${{ matrix.os }} (Zulu JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure}})
99-
uses: ./.github/workflows/linux-common.yml
100-
with:
101-
os: ${{ matrix.os }}
102-
jdk_distro: "zulu"
103-
jdk_version: ${{ matrix.jdk_version }}
104-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
105-
106-
# ------------------ RSA 1024 min size sanity check -------------------
107-
# Only check one Linux and Mac JDK version as a sanity check. Using Zulu,
108-
# but this can be expanded if needed.
109-
# wolfSSL ./configure:
110-
# --enable-jni CFLAGS="-DRSA_MIN_SIZE=1024
111-
linux-zulu-rsa-min-size:
112-
strategy:
113-
matrix:
114-
os: [ 'ubuntu-latest', 'macos-latest' ]
115-
jdk_version: [ '11' ]
116-
wolfssl_configure: [ '--enable-jni CFLAGS="-DRSA_MIN_SIZE=1024"' ]
117-
name: ${{ matrix.os }} (Zulu JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure}})
118-
uses: ./.github/workflows/linux-common.yml
119-
with:
120-
os: ${{ matrix.os }}
121-
jdk_distro: "zulu"
122-
jdk_version: ${{ matrix.jdk_version }}
123-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
124-
125-
# ------------------ Facebook Infer static analysis -------------------
126-
# Run Facebook infer over PR code, only running on Linux with one
127-
# JDK/version for now.
128-
fb-infer:
129-
strategy:
130-
matrix:
131-
os: [ 'ubuntu-latest' ]
132-
jdk_version: [ '11' ]
133-
wolfssl_configure: [ '--enable-jni --enable-all' ]
134-
name: Facebook Infer (${{ matrix.os }} Zulu JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure }})
135-
uses: ./.github/workflows/infer.yml
136-
with:
137-
os: ${{ matrix.os }}
138-
jdk_distro: "zulu"
139-
jdk_version: ${{ matrix.jdk_version }}
140-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
141-
142-
# ----------------------- Android Gradle build ------------------------
143-
# Run Android gradle build over PR code, only running on Linux with one
144-
# JDK/version for now.
145-
android-gradle:
146-
strategy:
147-
matrix:
148-
os: [ 'ubuntu-latest' ]
149-
jdk_version: [ '21' ]
150-
name: Android Gradle (${{ matrix.os }} Zulu JDK ${{ matrix.jdk_version }})
151-
uses: ./.github/workflows/android_gradle.yml
152-
with:
153-
os: ${{ matrix.os }}
154-
jdk_distro: "zulu"
155-
jdk_version: ${{ matrix.jdk_version }}
156-
157-
# --------------------- Maven build - test pom.xml --------------------
158-
# Run Maven build over PR code, running on Linux and Mac with only one
159-
# JDK/version for now.
160-
maven-build:
161-
strategy:
162-
matrix:
163-
os: [ 'ubuntu-latest', 'macos-latest' ]
164-
jdk_version: [ '21' ]
165-
wolfssl_configure: [ '--enable-jni' ]
166-
name: Maven Build (${{ matrix.os }} Zulu JDK ${{ matrix.jdk_version }})
167-
uses: ./.github/workflows/maven.yml
168-
with:
169-
os: ${{ matrix.os }}
170-
jdk_distro: "zulu"
171-
jdk_version: ${{ matrix.jdk_version }}
172-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
173-
174-
# --------------- AddressSanitizer build and test ------------------
175-
# Run AddressSanitizer build and test on Linux only for memory error detection
176-
address-sanitizer:
177-
strategy:
178-
matrix:
179-
os: [ 'ubuntu-latest' ]
180-
jdk_version: [ '21' ]
181-
wolfssl_configure: [ '--enable-jni' ]
182-
name: AddressSanitizer (${{ matrix.os }} Zulu JDK ${{ matrix.jdk_version }})
183-
uses: ./.github/workflows/sanitizer-common.yml
184-
with:
185-
os: ${{ matrix.os }}
186-
jdk_distro: "zulu"
187-
jdk_version: ${{ matrix.jdk_version }}
188-
wolfssl_configure: ${{ matrix.wolfssl_configure }}
9+
# --------------- Windows Visual Studio build ----------------------
10+
# Test building wolfcrypt-jni on Windows with Visual Studio using
11+
# the solution and project files in ./IDE/WIN (Normal wolfSSL non-FIPS)
12+
windows-vs-build:
13+
name: Windows Visual Studio (Normal wolfSSL non-FIPS)
14+
uses: ./.github/workflows/windows-vs.yml
18915

.github/workflows/windows-vs.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Windows Visual Studio Build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
windows-vs-build:
8+
runs-on: windows-latest
9+
name: Windows Visual Studio (Normal wolfSSL non-FIPS)
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
path: wolfcryptjni
15+
16+
- name: Checkout wolfSSL
17+
uses: actions/checkout@v4
18+
with:
19+
repository: wolfSSL/wolfssl
20+
ref: master
21+
path: wolfssl
22+
23+
- name: Setup MSBuild
24+
uses: microsoft/setup-msbuild@v2
25+
with:
26+
msbuild-architecture: x64
27+
28+
- name: Setup Java
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: 'zulu'
32+
java-version: '11'
33+
34+
- name: Setup Apache Ant
35+
run: |
36+
Invoke-WebRequest -Uri "https://dlcdn.apache.org/ant/binaries/apache-ant-1.10.14-bin.zip" -OutFile "ant.zip"
37+
Expand-Archive -Path "ant.zip" -DestinationPath "C:\"
38+
echo "ANT_HOME=C:\apache-ant-1.10.14" >> $env:GITHUB_ENV
39+
echo "C:\apache-ant-1.10.14\bin" >> $env:GITHUB_PATH
40+
41+
- name: Download JUnit dependencies
42+
run: |
43+
New-Item -ItemType Directory -Force -Path "junit"
44+
Invoke-WebRequest -Uri "https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar" -OutFile "junit\junit-4.13.2.jar"
45+
Invoke-WebRequest -Uri "https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar" -OutFile "junit\hamcrest-all-1.3.jar"
46+
echo "JUNIT_HOME=${{ github.workspace }}\junit" >> $env:GITHUB_ENV
47+
48+
- name: Configure wolfSSL user_settings.h for wolfCrypt JNI
49+
run: |
50+
$userSettingsPath = "wolfssl\IDE\WIN\user_settings.h"
51+
$content = Get-Content $userSettingsPath -Raw
52+
$newDefines = @"
53+
#define WOLFSSL_KEY_GEN
54+
#define HAVE_CRL
55+
#define OPENSSL_ALL
56+
57+
"@
58+
$insertPoint = $content.IndexOf("/* Configuration */")
59+
if ($insertPoint -ne -1) {
60+
$newContent = $content.Insert($insertPoint, $newDefines)
61+
Set-Content -Path $userSettingsPath -Value $newContent
62+
} else {
63+
Write-Error "Could not find insertion point in user_settings.h"
64+
}
65+
66+
- name: Build wolfSSL DLL (x64 DLL Release)
67+
run: |
68+
cd wolfssl
69+
msbuild wolfssl64.sln -p:Configuration="DLL Release" -p:Platform=x64
70+
71+
- name: Build wolfCrypt JNI DLL (x64 DLL Release)
72+
run: |
73+
cd wolfcryptjni\IDE\WIN
74+
msbuild wolfcryptjni.sln -p:Configuration="DLL Release" -p:Platform=x64
75+
76+
- name: Run JUnit tests (Windows x64 Release)
77+
run: |
78+
cd wolfcryptjni
79+
ant test-win64-release
80+
81+
- name: Show logs on failure
82+
if: failure() || cancelled()
83+
run: |
84+
if (Test-Path "wolfcryptjni\build\reports") {
85+
Get-ChildItem "wolfcryptjni\build\reports\*.txt" | ForEach-Object { Get-Content $_.FullName }
86+
}

0 commit comments

Comments
 (0)