Skip to content

Add CI that builds and runs every example #26

Add CI that builds and runs every example

Add CI that builds and runs every example #26

Workflow file for this run

name: Java
on:
push:
paths:
- 'java/**'
- '.github/workflows/java.yml'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
# No cron: nightly.yml calls this, so the whole nightly is ONE run
# and therefore one triage writer. See nightly.yml's header.
workflow_call:
inputs:
caller_run_id:
description: 'run id of the calling workflow; keeps a called run in its own concurrency group'
type: string
default: ''
workflow_dispatch:
# Hardcode this workflow's OWN name: github.workflow is the CALLER's in a called
# workflow, so keying on it put all 12 targets in one group -- and GitHub cancels
# the previously-pending run in a group, so only the last target survived.
concurrency:
group: ${{ inputs.caller_run_id && format('java-call-{0}', inputs.caller_run_id) || format('java-{0}', github.ref) }}
cancel-in-progress: ${{ !inputs.caller_run_id }}
permissions:
contents: read
jobs:
resolve:
uses: ./.github/workflows/_resolve-wolfssl.yml
with:
stable_count: 1
java:
needs: resolve
name: Build / java (https-url) wolfSSL ${{ matrix.wolfssl_ref }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
wolfssl_ref: ${{ fromJson(needs.resolve.outputs.refs_json) }}
timeout-minutes: 25
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
# README: javac -cp <wolfssljni>/lib/wolfssl-jsse.jar URLClient.java
# so wolfSSL must be built with JNI support and wolfssljni built on top.
- name: Build wolfSSL and wolfssljni
run: |
set -euo pipefail
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends ant >/dev/null
git clone -q --depth 1 --branch '${{ matrix.wolfssl_ref }}' https://github.com/wolfSSL/wolfssl /tmp/wolfssl
cd /tmp/wolfssl
./autogen.sh >/dev/null 2>&1
./configure --enable-jni --enable-static --enable-shared >/dev/null
make -j"$(nproc)" >/dev/null
sudo make install >/dev/null
sudo ldconfig
git clone -q --depth 1 https://github.com/wolfSSL/wolfssljni /tmp/wolfssljni
cd /tmp/wolfssljni
./java.sh
ant
test -f lib/wolfssl-jsse.jar || { echo "FAIL: wolfssl-jsse.jar not built"; exit 1; }
- name: Compile URLClient
run: |
set -euo pipefail
cd java/https-url
javac -cp /tmp/wolfssljni/lib/wolfssl-jsse.jar URLClient.java
test -f URLClient.class || { echo "FAIL: no class produced"; exit 1; }
echo "verified: URLClient.class"