Linux #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux | |
on: | |
push: | |
branches: [ master, '*-ci' ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
build_linux: | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: ["ubuntu-20.04", "ubuntu-22.04"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 8 | |
- name: Install Mosquitto library | |
run: sudo apt-get install mosquitto | |
- name: Build Zserio Java Pub/Sub Paho Mqtt | |
run: | | |
# download the latest zserio version | |
mvn dependency:copy -Dmaven.repo.local="build/download" \ | |
-Dartifact=io.github.ndsev:zserio:LATEST \ | |
-DoutputDirectory="build" -Dmdep.stripVersion=true | |
# download the latest zserio runtime version | |
mvn dependency:copy -Dmaven.repo.local="build/download" \ | |
-Dartifact=io.github.ndsev:zserio-runtime:LATEST \ | |
-DoutputDirectory="build" -Dmdep.stripVersion=true | |
# download paho client | |
mvn dependency:copy -Dmaven.repo.local="build/download" \ | |
-Dartifact=org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.2 \ | |
-DoutputDirectory="build" -Dmdep.stripVersion=true | |
# generate example using Zserio | |
java -jar build/zserio.jar \ | |
-src examples/zserio/pubsub/paho/mqtt/examples/calculator calculator.zs -java build \ | |
-setTopLevelPackage paho.mqtt.examples.calculator.gen | |
# compile example | |
javac -d build -cp "build/zserio-runtime.jar:build/org.eclipse.paho.client.mqttv3.jar" \ | |
src/zserio/pubsub/paho/mqtt/*.java \ | |
examples/zserio/pubsub/paho/mqtt/examples/calculator/*.java \ | |
build/paho/mqtt/examples/calculator/gen/calculator/*.java | |
- name: Test Zserio Java Pub/Sub Paho Mqtt | |
run: | | |
PUBSUB_CLASSPATH="build/zserio-runtime.jar:build/org.eclipse.paho.client.mqttv3.jar:build" | |
java -cp "${PUBSUB_CLASSPATH}" \ | |
zserio.pubsub.paho.mqtt.examples.calculator.PowerOfTwoProvider & | |
java -cp "${PUBSUB_CLASSPATH}" \ | |
zserio.pubsub.paho.mqtt.examples.calculator.SquareRootOfProvider & | |
sleep 10 | |
{ echo "p"; sleep 1; echo "100"; sleep 1; echo "q"; } | java -cp ${PUBSUB_CLASSPATH} \ | |
zserio.pubsub.paho.mqtt.examples.calculator.CalculatorClient | grep "square root of: 10.0" | |
{ echo "s"; sleep 1; echo "100"; sleep 1; echo "q"; } | java -cp ${PUBSUB_CLASSPATH} \ | |
zserio.pubsub.paho.mqtt.examples.calculator.CalculatorClient | grep "power of two: 10000" | |
kill $(jobs -p) | |
- name: Archive Zserio Java Pub/Sub Paho Mqtt classes | |
uses: actions/upload-artifact@v3 | |
with: | |
name: zserio-pubsub-paho-mqtt-java-${{matrix.os}} | |
path: | | |
build/paho/**/*.class | |
build/zserio/**/*.class | |
build/*.jar |