blob: a10a8bf2af5d3110e530bae2e682a473efb35523 [file] [log] [blame]
name: On Host Test
description: Runs on-host tests.
inputs:
os:
description: "Host OS (either linux or windows)."
required: true
runs:
using: "composite"
steps:
- name: Set up Cloud SDK
uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1
- name: Configure Environment
id: configure-environment
shell: bash
run: |
set -x
if [ "${{inputs.os}}" == 'linux' ]
then
echo "ARCHIVE_EXTENSION=tar.xz" >> $GITHUB_ENV
elif [ "${{inputs.os}}" == 'windows' ]
then
echo "ARCHIVE_EXTENSION=tar.gz" >> $GITHUB_ENV
fi
- name: Download Archive
shell: bash
env:
WORKFLOW: ${{ github.workflow }}
run: |
set -x
PROJECT_NAME=$(gcloud config get-value project)
gsutil cp gs://${PROJECT_NAME}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{matrix.platform}}_${{matrix.config}}/${{matrix.platform}}_${{matrix.config}}.${ARCHIVE_EXTENSION} ${GITHUB_WORKSPACE}/out/tmp/${{matrix.platform}}_${{matrix.config}}.${ARCHIVE_EXTENSION}
- name: Extract Archive
shell: bash
run: |
set -x
parallel=
if [[ "${{inputs.os}}" == 'linux' ]]; then
parallel="--parallel"
fi
python3 ${GITHUB_WORKSPACE}/tools/create_archive.py -x -s ${GITHUB_WORKSPACE}/out/tmp/${{matrix.platform}}_${{matrix.config}}.${ARCHIVE_EXTENSION} -d ${GITHUB_WORKSPACE}/out ${parallel}
rm -rf ${GITHUB_WORKSPACE}/out/tmp
- name: Download Bootloader Archive
if: ${{ env.COBALT_BOOTLOADER != null && env.COBALT_BOOTLOADER != 'null' }}
shell: bash
env:
WORKFLOW: ${{ github.workflow }}
run: |
set -x
PROJECT_NAME=$(gcloud config get-value project)
gsutil cp gs://${PROJECT_NAME}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{matrix.platform}}_${{matrix.config}}/${COBALT_BOOTLOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION} ${GITHUB_WORKSPACE}/out/tmp/${COBALT_BOOTLOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION}
- name: Extract Bootloader Archive
if: ${{ env.COBALT_BOOTLOADER != null && env.COBALT_BOOTLOADER != 'null' }}
shell: bash
run: |
set -x
python3 ${GITHUB_WORKSPACE}/tools/create_archive.py -x -s ${GITHUB_WORKSPACE}/out/tmp/${COBALT_BOOTLOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION} -d ${GITHUB_WORKSPACE}/out --parallel
rm -rf ${GITHUB_WORKSPACE}/out/tmp
- name: Set Env Variables
shell: bash
run: |
echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "TEST_RESULTS_DIR=${GITHUB_WORKSPACE}/unit-test-results" >> $GITHUB_ENV
echo "TEST_REPORT_FILE=${GITHUB_WORKSPACE}/${{matrix.platform}}-${{matrix.shard}}" >> $GITHUB_ENV
- name: Run Tests
shell: bash
run: |
set -x
loader_args=''
if [ "${COBALT_BOOTLOADER}" != "null" ]; then
loader_args="--loader_platform ${COBALT_BOOTLOADER} --loader_config ${{matrix.config}}"
fi
if [[ "${{matrix.shard}}" == 'integration' ]]; then
xvfb-run -a --server-args="-screen 0 1920x1080x24i +render +extension GLX -noreset" python3 $GITHUB_WORKSPACE/cobalt/black_box_tests/black_box_tests.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} ${loader_args}
elif [[ "${{matrix.shard}}" == 'blackbox' ]]; then
xvfb-run -a --server-args="-screen 0 1920x1080x24i +render +extension GLX -noreset" python3 $GITHUB_WORKSPACE/cobalt/black_box_tests/black_box_tests.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} ${loader_args} --test_set blackbox
elif [[ "${{matrix.shard}}" == 'wpt' ]]; then
xvfb-run -a --server-args="-screen 0 1920x1080x24i +render +extension GLX -noreset" python3 $GITHUB_WORKSPACE/cobalt/black_box_tests/black_box_tests.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} ${loader_args} --test_set wpt
elif [[ "${{matrix.shard}}" == 'evergreen' ]]; then
xvfb-run -a --server-args="-screen 0 1920x1080x24i +render +extension GLX -noreset" python3 $GITHUB_WORKSPACE/cobalt/evergreen_tests/evergreen_tests.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} ${loader_args} --no-can_mount_tmpfs
else
if [[ "${{inputs.os}}" == 'windows' ]]; then
python3 ${GITHUB_WORKSPACE}/starboard/tools/testing/test_runner.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} -s ${{matrix.shard}} -r
else
xvfb-run -a --server-args="-screen 0 1920x1080x24i +render +extension GLX -noreset" python3 ${GITHUB_WORKSPACE}/starboard/tools/testing/test_runner.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} -s ${{matrix.shard}} -r ${loader_args} --xml_output_dir=${TEST_RESULTS_DIR}
fi
fi
- name: Process unit test results
if: failure()
shell: bash
run: |
set -x
echo "Saving unit test report to ${TEST_REPORT_FILE}"
python3 ${GITHUB_WORKSPACE}/starboard/tools/testing/test_report_parser.py ${TEST_RESULTS_DIR} > ${TEST_REPORT_FILE}
- name: Upload unit test report
uses: actions/upload-artifact@v3
if: failure()
with:
name: unit-test-reports
path: ${{env.TEST_REPORT_FILE}}