diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 325f2e8..3aecc29 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -154,3 +154,20 @@ jobs: jdk_distro: "zulu" jdk_version: ${{ matrix.jdk_version }} + # --------------------- Maven build - test pom.xml -------------------- + # Run Maven build over PR code, running on Linux and Mac with only one + # JDK/version for now. + maven-build: + strategy: + matrix: + os: [ 'ubuntu-latest', 'macos-latest' ] + jdk_version: [ '21' ] + wolfssl_configure: [ '--enable-jni' ] + name: Maven Build (${{ matrix.os }} Zulu JDK ${{ matrix.jdk_version }}) + uses: ./.github/workflows/maven.yml + with: + os: ${{ matrix.os }} + jdk_distro: "zulu" + jdk_version: ${{ matrix.jdk_version }} + wolfssl_configure: ${{ matrix.wolfssl_configure }} + diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..9883620 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,73 @@ +name: Maven Build (pom.xml) + +on: + workflow_call: + inputs: + os: + required: true + type: string + jdk_distro: + required: true + type: string + jdk_version: + required: true + type: string + wolfssl_configure: + required: true + type: string + +jobs: + build_wolfcryptjni: + runs-on: ${{ inputs.os }} + steps: + - uses: actions/checkout@v4 + + - name: Build native wolfSSL + uses: wolfSSL/actions-build-autotools-project@v1 + with: + repository: wolfSSL/wolfssl + ref: master + path: wolfssl + configure: ${{ inputs.wolfssl_configure }} + check: false + install: true + + - name: Setup java + uses: actions/setup-java@v4 + with: + distribution: ${{ inputs.jdk_distro }} + java-version: ${{ inputs.jdk_version }} + + - name: Set LD_LIBRARY_PATH + run: | + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV" + + # Only copy appropriate makefile for platform currently being tested + - name: Copy makefile + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + cp makefile.linux makefile + elif [ "$RUNNER_OS" == "macOS" ]; then + cp makefile.macosx makefile + else + echo "$RUNNER_OS not supported" + exit 1 + fi + shell: bash + + - name: Build JNI library + run: PREFIX=$GITHUB_WORKSPACE/build-dir make + + # Maven build + - name: mvn compile + run: mvn compile + + - name: mvn test + run: mvn test + + - name: mvn package + run: mvn package + + - name: mvn clean + run: mvn clean +