Testing: consolidate JUnit setup into shared composite action with checksum verification

pull/386/head
Chris Conlon 2026-07-21 15:07:05 -06:00
parent e66bc90bb7
commit 9d4bd338f5
10 changed files with 60 additions and 161 deletions

View File

@ -0,0 +1,38 @@
name: 'Setup JUnit'
description: 'Cache and download the JUnit jars used by ant test, verify
their checksums, and export JUNIT_HOME'
# shasum is used instead of sha256sum because it is available on both
# the Linux and macOS hosted runners.
runs:
using: 'composite'
steps:
- name: Cache JUnit dependencies
id: cache-junit
uses: actions/cache@v4
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
shell: bash
run: |
wget --directory-prefix=$GITHUB_WORKSPACE/junit \
https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
echo "8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3 $GITHUB_WORKSPACE/junit/junit-4.13.2.jar" \
| shasum -a 256 -c -
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
shell: bash
run: |
wget --directory-prefix=$GITHUB_WORKSPACE/junit \
https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
echo "4877670629ab96f34f5f90ab283125fcd9acb7e683e66319a68be6eb2cca60de $GITHUB_WORKSPACE/junit/hamcrest-all-1.3.jar" \
| shasum -a 256 -c -
- name: Set JUNIT_HOME
shell: bash
run: echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"

View File

@ -29,19 +29,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
- name: Setup JUnit
uses: ./.github/actions/setup-junit
# Cache the installed wolfSSL build, keyed on the full configure
# string (including sanitizer flags), wolfSSL commit and OS/arch.
@ -98,7 +87,6 @@ jobs:
# This will let us catch all non-leak issues.
- name: Set environment variables
run: |
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"
echo "ASAN_OPTIONS=detect_leaks=0:abort_on_error=1:halt_on_error=1:print_stats=1" >> "$GITHUB_ENV"

View File

@ -33,28 +33,10 @@ jobs:
distribution: zulu
java-version: ${{ matrix.jdk_version }}
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: |
wget --directory-prefix=$GITHUB_WORKSPACE/junit \
https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
echo "8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3 $GITHUB_WORKSPACE/junit/junit-4.13.2.jar" \
| sha256sum -c -
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: |
wget --directory-prefix=$GITHUB_WORKSPACE/junit \
https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
echo "4877670629ab96f34f5f90ab283125fcd9acb7e683e66319a68be6eb2cca60de $GITHUB_WORKSPACE/junit/hamcrest-all-1.3.jar" \
| sha256sum -c -
# wolfssljni is checked out into the wolfssljni subdirectory, so
# the local composite action path includes that prefix.
- name: Setup JUnit
uses: ./wolfssljni/.github/actions/setup-junit
# Get latest wolfSSL stable version for FIPS Ready download URL
- name: Get latest wolfSSL stable version
@ -116,7 +98,6 @@ jobs:
- name: Set library paths
run: |
echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$GITHUB_WORKSPACE/wolfssljni/lib:$GITHUB_WORKSPACE/wolfcryptjni/lib" >> "$GITHUB_ENV"
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
# Build wolfssljni (wolfJSSE)
- name: Build wolfssljni JNI library

View File

@ -28,20 +28,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
- name: Setup JUnit
uses: ./.github/actions/setup-junit
# Cache the installed wolfSSL build. The key matches the one built
# in linux-common.yml for the same configure flags, so this job
@ -95,10 +83,6 @@ jobs:
distribution: 'zulu'
java-version: ${{ matrix.jdk_version }}
- name: Set JUNIT_HOME
run: |
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
- name: Set LD_LIBRARY_PATH
run: |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"
@ -222,20 +206,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
- name: Setup JUnit
uses: ./.github/actions/setup-junit
# Cache the installed wolfSSL build. The key matches the one built
# in linux-common.yml for the same configure flags, so this job
@ -289,10 +261,6 @@ jobs:
distribution: 'zulu'
java-version: '8'
- name: Set JUNIT_HOME
run: |
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
- name: Set LD_LIBRARY_PATH
run: |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"

View File

@ -152,19 +152,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: curl -fsSL -o "$GITHUB_WORKSPACE/junit/junit-4.13.2.jar" https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: curl -fsSL -o "$GITHUB_WORKSPACE/junit/hamcrest-all-1.3.jar" https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
- name: Setup JUnit
uses: ./.github/actions/setup-junit
- name: Build native wolfSSL
uses: wolfSSL/actions-build-autotools-project@v1
@ -182,10 +171,6 @@ jobs:
distribution: zulu
java-version: '21'
- name: Set JUNIT_HOME
run: |
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
- name: Set LD_LIBRARY_PATH
run: |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"

View File

@ -50,20 +50,8 @@ jobs:
java -version
file $(which java)
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
- name: Setup JUnit
uses: ./.github/actions/setup-junit
# Cache the installed wolfSSL build. The m32 key segment keeps
# these 32-bit builds separate from the 64-bit cache entries.
@ -114,7 +102,6 @@ jobs:
- name: Set environment variables
run: |
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib" >> $GITHUB_ENV
- name: Build JNI library (32-bit)

View File

@ -25,19 +25,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
- name: Setup JUnit
uses: ./.github/actions/setup-junit
# Cache the installed wolfSSL build. It depends only on the wolfSSL
# commit, configure flags, and OS/arch, not on the JDK in use, so
@ -91,9 +80,6 @@ jobs:
distribution: ${{ inputs.jdk_distro }}
java-version: ${{ inputs.jdk_version }}
- name: Set JUNIT_HOME
run: |
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
- name: Set LD_LIBRARY_PATH
run: |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"

View File

@ -33,14 +33,8 @@ jobs:
sudo apt-get update
sudo apt-get install -y ant
- name: Download JUnit
run: |
mkdir -p /tmp/junit
wget -q -P /tmp/junit \
"https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar"
EXPECTED_SHA="8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3"
echo "${EXPECTED_SHA} /tmp/junit/junit-4.13.2.jar" | sha256sum -c -
echo "JUNIT_HOME=/tmp/junit" >> $GITHUB_ENV
- name: Setup JUnit
uses: ./.github/actions/setup-junit
- name: Download and set up SpotBugs
run: |

View File

@ -43,20 +43,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
- name: Setup JUnit
uses: ./.github/actions/setup-junit
# Cache the installed wolfSSL build. Stable release tags do not
# move, so these entries stay valid indefinitely.
@ -104,10 +92,6 @@ jobs:
distribution: zulu
java-version: ${{ matrix.jdk_version }}
- name: Set JUNIT_HOME
run: |
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
- name: Set LD_LIBRARY_PATH
run: |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"

View File

@ -32,19 +32,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Cache JUnit dependencies
uses: actions/cache@v4
id: cache-junit
with:
path: junit
key: junit-jars-v1
- name: Download junit-4.13.2.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
- name: Download hamcrest-all-1.3.jar
if: steps.cache-junit.outputs.cache-hit != 'true'
run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar
- name: Setup JUnit
uses: ./.github/actions/setup-junit
# Cache the installed wolfSSL build, keyed on the full configure
# string (including sanitizer flags), wolfSSL commit and OS/arch.
@ -97,7 +86,6 @@ jobs:
- name: Set environment variables
run: |
echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"
echo "UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1" >> "$GITHUB_ENV"