Skip to content

Commit 9d96544

Browse files
committed
Testing: add GitHub action to test with CodeChecker static analyzer
1 parent d027842 commit 9d96544

File tree

2 files changed

+97
-180
lines changed

2 files changed

+97
-180
lines changed

.github/workflows/codechecker.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: CodeChecker Static Analysis
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
codechecker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
# Cache Junit JARs
16+
- name: Cache Junit JARs
17+
uses: actions/cache@v3
18+
id: cache-junit
19+
with:
20+
path: ${{ github.workspace }}/junit
21+
key: junit-cache-${{ runner.os }}-junit-4.13.2-hamcrest-1.3
22+
restore-keys: |
23+
junit-cache-${{ runner.os }}-
24+
25+
# Download Junit JARs (needed for full build)
26+
- name: Download junit-4.13.2.jar
27+
if: steps.cache-junit.outputs.cache-hit != 'true'
28+
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
29+
- name: Download hamcrest-all-1.3.jar
30+
if: steps.cache-junit.outputs.cache-hit != 'true'
31+
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
32+
33+
# Build native wolfSSL
34+
- name: Build native wolfSSL
35+
uses: wolfSSL/actions-build-autotools-project@v1
36+
with:
37+
repository: wolfSSL/wolfssl
38+
ref: master
39+
path: wolfssl
40+
configure: '--enable-jni --enable-all'
41+
check: false
42+
install: true
43+
44+
# Setup Java
45+
- name: Setup java
46+
uses: actions/setup-java@v4
47+
with:
48+
distribution: 'zulu'
49+
java-version: '11'
50+
51+
- name: Set JUNIT_HOME
52+
run: |
53+
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
54+
- name: Set LD_LIBRARY_PATH
55+
run: |
56+
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"
57+
58+
# Copy appropriate makefile for Linux
59+
- name: Copy makefile
60+
run: cp makefile.linux makefile
61+
62+
# Run CodeChecker static analysis
63+
- name: Run CodeChecker analysis
64+
uses: whisperity/codechecker-analysis-action@v1
65+
id: codechecker
66+
with:
67+
build-command: 'PREFIX=${{ github.workspace }}/build-dir make'
68+
ctu: true
69+
config: |
70+
{
71+
"CodeChecker": {
72+
"analyzer": [
73+
"--enable=sensitive"
74+
]
75+
}
76+
}
77+
78+
# Upload CodeChecker results as artifacts
79+
- name: Upload CodeChecker results
80+
if: always()
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: codechecker-reports
84+
path: ${{ steps.codechecker.outputs.result-html-dir }}
85+
86+
# Show CodeChecker results in logs
87+
- name: Show CodeChecker results
88+
if: always()
89+
run: |
90+
echo "=== CodeChecker analysis complete ==="
91+
echo "Warnings found: ${{ steps.codechecker.outputs.warnings }}"
92+
echo "CodeChecker version: ${{ steps.codechecker.outputs.codechecker-version }}"
93+
if [ "${{ steps.codechecker.outputs.warnings }}" -eq "0" ]; then
94+
echo "✅ No static analysis issues found"
95+
else
96+
echo "⚠️ Static analysis issues detected - check artifacts"
97+
fi

.github/workflows/main.yml

Lines changed: 0 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -6,184 +6,4 @@ 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 }}
1899

0 commit comments

Comments
 (0)