Windows #37
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: Windows | |
on: | |
push: | |
branches: [ master, '*-ci' ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
build_windows: | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: ["windows-latest"] | |
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 dependecies | |
run: choco install wget | |
shell: bash | |
- name: Install Mosquitto library | |
run: | | |
wget -P "${{github.workspace}}" https://mosquitto.org/files/binary/win64/mosquitto-2.0.18-install-windows-x64.exe | |
& "${{github.workspace}}/mosquitto-2.0.18-install-windows-x64.exe" /S | |
- 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 | |
shell: bash | |
- name: Test Zserio Java Pub/Sub Paho Mqtt | |
run: | | |
"/c/Program Files/mosquitto/mosquitto" & | |
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) | |
shell: bash | |
- 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 |