| # Copyright (c) 2023 Project CHIP Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| name: Java Tests |
| |
| on: |
| push: |
| pull_request: |
| merge_group: |
| workflow_dispatch: |
| |
| concurrency: |
| group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == |
| 'pull_request' && github.event.number) || (github.event_name == |
| 'workflow_dispatch' && github.run_number) || github.sha }} |
| cancel-in-progress: true |
| |
| env: |
| CHIP_NO_LOG_TIMESTAMPS: true |
| # XXX: Workaround for https://github.com/actions/cache/issues/1141 |
| SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 |
| |
| jobs: |
| java_tests_linux: |
| name: Linux |
| timeout-minutes: 130 |
| |
| env: |
| TSAN_OPTIONS: "halt_on_error=1 suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" |
| |
| if: github.actor != 'restyled-io[bot]' |
| runs-on: ubuntu-latest |
| |
| container: |
| image: connectedhomeip/chip-build-java:0.7.15 |
| options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 |
| net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" |
| |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v3.5.2 |
| - name: Checkout submodules |
| run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux |
| - name: Try to ensure the directories for core dumping exist and we |
| can write them. |
| run: | |
| mkdir /tmp/cores || true |
| sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true |
| mkdir objdir-clone || true |
| |
| - uses: Wandalen/wretry.action@v1.3.0 |
| name: Bootstrap cache |
| continue-on-error: true |
| timeout-minutes: 10 |
| with: |
| action: buildjet/cache@v3 |
| attempt_limit: 3 |
| attempt_delay: 2000 |
| with: | |
| key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} |
| path: | |
| .environment |
| build_overrides/pigweed_environment.gni |
| - name: Bootstrap |
| timeout-minutes: 10 |
| run: bash scripts/bootstrap.sh |
| - name: Uploading bootstrap logs |
| uses: actions/upload-artifact@v3 |
| if: ${{ always() && !env.ACT }} |
| with: |
| name: bootstrap-logs-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} |
| path: | |
| .environment/gn_out/.ninja_log |
| .environment/pigweed-venv/*.log |
| - name: Generate unit tests |
| timeout-minutes: 2 |
| run: | |
| scripts/run_in_build_env.sh \ |
| './scripts/build/build_examples.py \ |
| --target linux-x64-tests \ |
| gen \ |
| ' |
| - name: Build unit tests |
| timeout-minutes: 30 |
| run: scripts/run_in_build_env.sh 'ninja -C out/linux-x64-tests src:java_controller_tests' |
| |
| - name: Run unit tests |
| timeout-minutes: 15 |
| # TODO: this direct path loading is not maintainable. Our build system should define and |
| # support test classes. |
| run: | |
| $JAVA_PATH/bin/java \ |
| -cp 'third_party/java_deps/artifacts/*:out/linux-x64-tests/lib/src/controller/java/*' \ |
| org.junit.runner.JUnitCore \ |
| chip.tlv.TlvWriterTest \ |
| chip.tlv.TlvReadWriteTest \ |
| chip.tlv.TlvReaderTest \ |
| chip.jsontlv.JsonToTlvToJsonTest \ |
| chip.onboardingpayload.ManualCodeTest |
| - name: Build Java Matter Controller and all clusters app |
| timeout-minutes: 60 |
| run: | |
| scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv' |
| scripts/run_in_python_env.sh out/venv 'pip install -r scripts/setup/requirements.build.txt' |
| scripts/run_in_python_env.sh out/venv 'pip install colorama' |
| ./scripts/run_in_build_env.sh \ |
| "./scripts/build/build_examples.py \ |
| --target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test \ |
| --target linux-x64-java-matter-controller \ |
| build \ |
| " |
| - name: Run Discover Commissionables Test |
| timeout-minutes: 15 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "discover" \ |
| --tool-args "commissionables" \ |
| --factoryreset \ |
| ' |
| - name: Run Pairing Onnetwork Test |
| timeout-minutes: 15 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "pairing" \ |
| --tool-args "onnetwork-long --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ |
| --factoryreset \ |
| ' |
| - name: Run IM Invoke Test |
| timeout-minutes: 15 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "im" \ |
| --tool-args "onnetwork-long-im-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ |
| --factoryreset \ |
| ' |
| - name: Run IM Read Test |
| timeout-minutes: 15 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "im" \ |
| --tool-args "onnetwork-long-im-read --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ |
| --factoryreset \ |
| ' |
| - name: Run IM Write Test |
| timeout-minutes: 15 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "im" \ |
| --tool-args "onnetwork-long-im-write --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ |
| --factoryreset \ |
| ' |
| - name: Run IM Subscribe Test |
| timeout-minutes: 15 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "im" \ |
| --tool-args "onnetwork-long-im-subscribe --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ |
| --factoryreset \ |
| ' |
| - name: Run Pairing AlreadyDiscovered Test |
| timeout-minutes: 25 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "pairing" \ |
| --tool-args "already-discovered --nodeid 1 --setup-pin-code 20202021 --address ::1 --port 5540 -t 1000" \ |
| --factoryreset \ |
| ' |
| # Disabled due to failure: https://github.com/project-chip/connectedhomeip/issues/27361 |
| # - name: Run Pairing Address-PaseOnly Test |
| # timeout-minutes: 25 |
| # run: | |
| # scripts/run_in_python_env.sh out/venv \ |
| # './scripts/tests/run_java_test.py \ |
| # --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| # --app-args "--discriminator 3840 --interface-id -1" \ |
| # --tool-path out/linux-x64-java-matter-controller \ |
| # --tool-cluster "pairing" \ |
| # --tool-args "address-paseonly --nodeid 1 --setup-pin-code 20202021 --address ::1 --port 5540 -t 1000" \ |
| # --factoryreset \ |
| # ' |
| - name: Run Pairing SetupQRCode Test |
| timeout-minutes: 25 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "pairing" \ |
| --tool-args "code --nodeid 1 --setup-payload MT:-24J0AFN00KA0648G00 --discover-once 1 --use-only-onnetwork-discovery 0 -t 1000" \ |
| --factoryreset \ |
| ' |
| - name: Run Pairing ManualCode Test |
| timeout-minutes: 25 |
| run: | |
| scripts/run_in_python_env.sh out/venv \ |
| './scripts/tests/run_java_test.py \ |
| --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ |
| --app-args "--discriminator 3840 --interface-id -1" \ |
| --tool-path out/linux-x64-java-matter-controller \ |
| --tool-cluster "pairing" \ |
| --tool-args "code --nodeid 1 --setup-payload 34970112332 --discover-once 1 --use-only-onnetwork-discovery 0 -t 1000" \ |
| --factoryreset \ |
| ' |
| - name: Uploading core files |
| uses: actions/upload-artifact@v3 |
| if: ${{ failure() && !env.ACT }} |
| with: |
| name: crash-core-linux-java-controller |
| path: /tmp/cores/ |
| # Cores are big; don't hold on to them too long. |
| retention-days: 5 |
| - name: Uploading objdir for debugging |
| uses: actions/upload-artifact@v3 |
| if: ${{ failure() && !env.ACT }} |
| with: |
| name: crash-objdir-linux-java-controller |
| path: objdir-clone/ |
| # objdirs are big; don't hold on to them too long. |
| retention-days: 5 |