diff --git a/.github/config/xb1.json b/.github/config/xb1.json index 39d6247f5aca..69099c091eb9 100644 --- a/.github/config/xb1.json +++ b/.github/config/xb1.json @@ -3,6 +3,15 @@ "__comment" : "TODO: Deploy a runner and change this", "docker_runner_service": "runner-xb1", "runner_tag": "xb1", + "on_device_test": { + "enabled": true, + "tests": [ + "0", + "1", + "2", + "3" + ] + } "platforms": [ "xb1" ], diff --git a/.github/workflows/main_win.yaml b/.github/workflows/main_win.yaml index 77f55e7e87e0..73ccc1b70604 100644 --- a/.github/workflows/main_win.yaml +++ b/.github/workflows/main_win.yaml @@ -87,6 +87,11 @@ jobs: run: | includes=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -c '.includes') echo "includes=${includes}" >> $GITHUB_ENV + - id: set-on-device-test-attempts + shell: bash + run: | + on_device_test_attempts=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.on_device_test.test_attempts // empty') + echo "on_device_test_attempts=${on_device_test_attempts}" >> $GITHUB_ENV - id: set-on-device-test shell: bash run: | @@ -121,6 +126,7 @@ jobs: platforms: ${{ env.platforms }} includes: ${{ env.includes }} on_device_test: ${{ env.on_device_test }} + on_device_test_attempts: ${{ env.on_device_test_attempts }} on_host_test: ${{ env.on_host_test }} on_host_test_shards: ${{ env.on_host_test_shards }} docker_service: ${{ env.docker_service }} @@ -187,6 +193,43 @@ jobs: type: onhost os: windows + # Runs on-device integration and unit tests. + on-device-test: + needs: [initialize, build] + # Run ODT when on_device label is applied on PR. + # Also, run ODT on push and schedule if not explicitly disabled via repo vars. + if: | + fromJSON(needs.initialize.outputs.on_device_test).enabled == true && (( + github.event_name == 'pull_request' && + contains(github.event.pull_request.labels.*.name, 'on_device') ) || (( + inputs.nightly == 'true' || github.event_name == 'schedule') && + vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') || + ( github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False' ) ) + runs-on: [self-hosted, odt-runner] + name: ${{ matrix.name }}_on_device_${{ matrix.shard }} + container: ${{ needs.docker-unittest-image.outputs.docker_unittest_tag }} + permissions: {} + strategy: + fail-fast: false + matrix: + platform: ${{ fromJson(needs.initialize.outputs.platforms) }} + config: [devel] + shard: ${{ fromJson(needs.initialize.outputs.on_device_test).tests }} + include: ${{ fromJson(needs.initialize.outputs.includes) }} + env: + COBALT_BOOTLOADER: ${{ needs.initialize.outputs.bootloader }} + ON_DEVICE_TEST_ATTEMPTS: ${{ needs.initialize.outputs.on_device_test_attempts }} + MODULAR_BUILD: ${{ inputs.modular && 1 || 0 }} + steps: + - name: Checkout + uses: kaidokert/checkout@v3.5.999 + timeout-minutes: 30 + with: + fetch-depth: 1 + persist-credentials: false + - name: Run Tests (${{ matrix.shard }}) + uses: ./.github/actions/on_device_tests + # Runs on the host unit and integration tests. on-host-test: needs: [initialize, build]