|
| 1 | +name: Windows |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, '*-ci' ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + workflow_dispatch: |
| 9 | + schedule: |
| 10 | + - cron: '0 0 * * 0' |
| 11 | + |
| 12 | +jobs: |
| 13 | + build_windows: |
| 14 | + runs-on: ${{matrix.os}} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + os: ["windows-latest"] |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v3 |
| 21 | + with: |
| 22 | + submodules: recursive |
| 23 | + |
| 24 | + - name: Set up JDK 1.8 |
| 25 | + uses: actions/setup-java@v3 |
| 26 | + with: |
| 27 | + distribution: temurin |
| 28 | + java-version: 8 |
| 29 | + |
| 30 | + - name: Install dependecies |
| 31 | + run: choco install wget |
| 32 | + shell: bash |
| 33 | + |
| 34 | + - name: Install Mosquitto library |
| 35 | + run: | |
| 36 | + wget -P "${{github.workspace}}" https://mosquitto.org/files/binary/win64/mosquitto-2.0.18-install-windows-x64.exe |
| 37 | + & "${{github.workspace}}/mosquitto-2.0.18-install-windows-x64.exe" /S |
| 38 | +
|
| 39 | + - name: Build Zserio Java Pub/Sub Paho Mqtt |
| 40 | + run: | |
| 41 | + # download the latest zserio version |
| 42 | + mvn dependency:copy -Dmaven.repo.local="build/download" \ |
| 43 | + -Dartifact=io.github.ndsev:zserio:LATEST \ |
| 44 | + -DoutputDirectory="build" -Dmdep.stripVersion=true |
| 45 | +
|
| 46 | + # download the latest zserio runtime version |
| 47 | + mvn dependency:copy -Dmaven.repo.local="build/download" \ |
| 48 | + -Dartifact=io.github.ndsev:zserio-runtime:LATEST \ |
| 49 | + -DoutputDirectory="build" -Dmdep.stripVersion=true |
| 50 | +
|
| 51 | + # download paho client |
| 52 | + mvn dependency:copy -Dmaven.repo.local="build/download" \ |
| 53 | + -Dartifact=org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.2 \ |
| 54 | + -DoutputDirectory="build" -Dmdep.stripVersion=true |
| 55 | +
|
| 56 | + # generate example using Zserio |
| 57 | + java -jar build/zserio.jar \ |
| 58 | + -src examples/zserio/pubsub/paho/mqtt/examples/calculator calculator.zs -java build \ |
| 59 | + -setTopLevelPackage paho.mqtt.examples.calculator.gen |
| 60 | +
|
| 61 | + # compile example |
| 62 | + javac -d build -cp "build/zserio-runtime.jar;build/org.eclipse.paho.client.mqttv3.jar" \ |
| 63 | + src/zserio/pubsub/paho/mqtt/*.java \ |
| 64 | + examples/zserio/pubsub/paho/mqtt/examples/calculator/*.java \ |
| 65 | + build/paho/mqtt/examples/calculator/gen/calculator/*.java |
| 66 | + shell: bash |
| 67 | + |
| 68 | + - name: Test Zserio Java Pub/Sub Paho Mqtt |
| 69 | + run: | |
| 70 | + "/c/Program Files/mosquitto/mosquitto" & |
| 71 | + PUBSUB_CLASSPATH="build/zserio-runtime.jar;build/org.eclipse.paho.client.mqttv3.jar;build" |
| 72 | + java -cp "${PUBSUB_CLASSPATH}" \ |
| 73 | + zserio.pubsub.paho.mqtt.examples.calculator.PowerOfTwoProvider & |
| 74 | + java -cp "${PUBSUB_CLASSPATH}" \ |
| 75 | + zserio.pubsub.paho.mqtt.examples.calculator.SquareRootOfProvider & |
| 76 | + sleep 10 |
| 77 | + { echo "p"; sleep 1; echo "100"; sleep 1; echo "q"; } | java -cp ${PUBSUB_CLASSPATH} \ |
| 78 | + zserio.pubsub.paho.mqtt.examples.calculator.CalculatorClient | grep "square root of: 10.0" |
| 79 | + { echo "s"; sleep 1; echo "100"; sleep 1; echo "q"; } | java -cp ${PUBSUB_CLASSPATH} \ |
| 80 | + zserio.pubsub.paho.mqtt.examples.calculator.CalculatorClient | grep "power of two: 10000" |
| 81 | + kill $(jobs -p) |
| 82 | + shell: bash |
| 83 | + |
| 84 | + - name: Archive Zserio Java Pub/Sub Paho Mqtt classes |
| 85 | + uses: actions/upload-artifact@v3 |
| 86 | + with: |
| 87 | + name: zserio-pubsub-paho-mqtt-java-${{matrix.os}} |
| 88 | + path: | |
| 89 | + build/paho/**/*.class |
| 90 | + build/zserio/**/*.class |
| 91 | + build/*.jar |
0 commit comments