|
| 1 | +name: Test Against Stable wolfSSL Releases |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ 'master' ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + # First job: dynamically fetch the last 5 stable wolfSSL release tags |
| 9 | + get-stable-releases: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + versions: ${{ steps.get-versions.outputs.versions }} |
| 13 | + steps: |
| 14 | + - name: Get last 5 stable wolfSSL releases |
| 15 | + id: get-versions |
| 16 | + run: | |
| 17 | + # Fetch tags from wolfSSL/wolfssl that end with "-stable" |
| 18 | + # Sort by version number and take the last 5 |
| 19 | + VERSIONS=$(curl -s "https://api.github.com/repos/wolfSSL/wolfssl/tags?per_page=100" | \ |
| 20 | + jq -r '.[].name | select(endswith("-stable"))' | \ |
| 21 | + sort -V | \ |
| 22 | + tail -n 5 | \ |
| 23 | + jq -R -s -c 'split("\n") | map(select(length > 0))') |
| 24 | + echo "Found stable versions: $VERSIONS" |
| 25 | + echo "versions=$VERSIONS" >> $GITHUB_OUTPUT |
| 26 | +
|
| 27 | + # Second job: build and test against each stable release |
| 28 | + test-stable-release: |
| 29 | + needs: get-stable-releases |
| 30 | + runs-on: ubuntu-latest |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + wolfssl_version: ${{ fromJson(needs.get-stable-releases.outputs.versions) }} |
| 35 | + jdk_version: [ '21' ] |
| 36 | + wolfssl_configure: [ '--enable-jni', '--enable-jni --enable-all' ] |
| 37 | + name: wolfSSL ${{ matrix.wolfssl_version }} (JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure }}) |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + |
| 41 | + - name: Cache JUnit dependencies |
| 42 | + uses: actions/cache@v4 |
| 43 | + id: cache-junit |
| 44 | + with: |
| 45 | + path: junit |
| 46 | + key: junit-jars-v1 |
| 47 | + |
| 48 | + - name: Download junit-4.13.2.jar |
| 49 | + if: steps.cache-junit.outputs.cache-hit != 'true' |
| 50 | + run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar |
| 51 | + |
| 52 | + - name: Download hamcrest-all-1.3.jar |
| 53 | + if: steps.cache-junit.outputs.cache-hit != 'true' |
| 54 | + run: wget --directory-prefix=$GITHUB_WORKSPACE/junit https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar |
| 55 | + |
| 56 | + - name: Build native wolfSSL ${{ matrix.wolfssl_version }} |
| 57 | + uses: wolfSSL/actions-build-autotools-project@v1 |
| 58 | + with: |
| 59 | + repository: wolfSSL/wolfssl |
| 60 | + ref: ${{ matrix.wolfssl_version }} |
| 61 | + path: wolfssl |
| 62 | + configure: ${{ matrix.wolfssl_configure }} |
| 63 | + check: false |
| 64 | + install: true |
| 65 | + |
| 66 | + - name: Setup java |
| 67 | + uses: actions/setup-java@v4 |
| 68 | + with: |
| 69 | + distribution: zulu |
| 70 | + java-version: ${{ matrix.jdk_version }} |
| 71 | + |
| 72 | + - name: Set JUNIT_HOME |
| 73 | + run: | |
| 74 | + echo "JUNIT_HOME=$GITHUB_WORKSPACE/junit" >> "$GITHUB_ENV" |
| 75 | +
|
| 76 | + - name: Set LD_LIBRARY_PATH |
| 77 | + run: | |
| 78 | + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV" |
| 79 | +
|
| 80 | + - name: Copy makefile |
| 81 | + run: cp makefile.linux makefile |
| 82 | + |
| 83 | + - name: Build JNI library |
| 84 | + run: PREFIX=$GITHUB_WORKSPACE/build-dir make |
| 85 | + |
| 86 | + - name: Build JAR (ant build-jce-debug) |
| 87 | + run: ant build-jce-debug |
| 88 | + |
| 89 | + - name: Run Java tests (ant test) |
| 90 | + run: ant test |
| 91 | + |
| 92 | + - name: Show logs on failure |
| 93 | + if: failure() || cancelled() |
| 94 | + run: | |
| 95 | + cat build/reports/*.txt |
0 commit comments