blob: 911c11ddbef771ede22ea7ba33488a4eeec5d5ed [file] [log] [blame]
# 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
- 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
- name: Bootstrap cache
uses: actions/cache@v3
timeout-minutes: 10
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: 1
run: |
scripts/run_in_build_env.sh \
'./scripts/build/build_examples.py \
--target linux-x64-tests \
gen \
'
- name: Build unit tests
timeout-minutes: 25
run: scripts/run_in_build_env.sh 'ninja -C out/linux-x64-tests src:java_controller_tests'
- name: Run unit tests
timeout-minutes: 10
# 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
- name: Build Java Matter Controller and all clusters app
timeout-minutes: 50
run: |
scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env'
./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: 10
run: |
scripts/run_in_build_env.sh \
'./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: 10
run: |
scripts/run_in_build_env.sh \
'./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: 10
run: |
scripts/run_in_build_env.sh \
'./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: 10
run: |
scripts/run_in_build_env.sh \
'./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: 10
run: |
scripts/run_in_build_env.sh \
'./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: 10
run: |
scripts/run_in_build_env.sh \
'./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: 10
run: |
scripts/run_in_build_env.sh \
'./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 \
'
- name: Run Pairing Address-PaseOnly Test
timeout-minutes: 10
run: |
scripts/run_in_build_env.sh \
'./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: 10
run: |
scripts/run_in_build_env.sh \
'./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: 10
run: |
scripts/run_in_build_env.sh \
'./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