diff --git a/.github/actions/setup-junit/action.yml b/.github/actions/setup-junit/action.yml new file mode 100644 index 0000000..d6720e8 --- /dev/null +++ b/.github/actions/setup-junit/action.yml @@ -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" diff --git a/.github/workflows/address-sanitizer.yml b/.github/workflows/address-sanitizer.yml index 3b6cc38..ae6d2b7 100644 --- a/.github/workflows/address-sanitizer.yml +++ b/.github/workflows/address-sanitizer.yml @@ -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" diff --git a/.github/workflows/fips-ready-dual-provider.yml b/.github/workflows/fips-ready-dual-provider.yml index 41bb36e..a94e46b 100644 --- a/.github/workflows/fips-ready-dual-provider.yml +++ b/.github/workflows/fips-ready-dual-provider.yml @@ -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 diff --git a/.github/workflows/java-module-test.yml b/.github/workflows/java-module-test.yml index 7c4880b..fb72df8 100644 --- a/.github/workflows/java-module-test.yml +++ b/.github/workflows/java-module-test.yml @@ -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" diff --git a/.github/workflows/jni-patched-ci.yml b/.github/workflows/jni-patched-ci.yml index 8f0b5ae..464f834 100644 --- a/.github/workflows/jni-patched-ci.yml +++ b/.github/workflows/jni-patched-ci.yml @@ -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" diff --git a/.github/workflows/linux-32bit.yml b/.github/workflows/linux-32bit.yml index a8a98c6..cc066cc 100644 --- a/.github/workflows/linux-32bit.yml +++ b/.github/workflows/linux-32bit.yml @@ -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) diff --git a/.github/workflows/linux-common.yml b/.github/workflows/linux-common.yml index 6689476..a875afe 100644 --- a/.github/workflows/linux-common.yml +++ b/.github/workflows/linux-common.yml @@ -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" diff --git a/.github/workflows/spotbugs.yml b/.github/workflows/spotbugs.yml index 283d6e3..7a6c67b 100644 --- a/.github/workflows/spotbugs.yml +++ b/.github/workflows/spotbugs.yml @@ -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: | diff --git a/.github/workflows/stable-wolfssl-releases.yml b/.github/workflows/stable-wolfssl-releases.yml index 192cb8b..06f9bec 100644 --- a/.github/workflows/stable-wolfssl-releases.yml +++ b/.github/workflows/stable-wolfssl-releases.yml @@ -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" diff --git a/.github/workflows/undefined-sanitizer.yml b/.github/workflows/undefined-sanitizer.yml index 043dbca..89cb6bc 100644 --- a/.github/workflows/undefined-sanitizer.yml +++ b/.github/workflows/undefined-sanitizer.yml @@ -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"