| 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 Evergreen loader Archive |
| if: ${{ env.COBALT_EVERGREEN_LOADER != null && env.COBALT_EVERGREEN_LOADER != '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_EVERGREEN_LOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION} ${GITHUB_WORKSPACE}/out/tmp/${COBALT_EVERGREEN_LOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION} |
| - name: Extract Evergreen loader Archive |
| if: ${{ env.COBALT_EVERGREEN_LOADER != null && env.COBALT_EVERGREEN_LOADER != 'null' }} |
| shell: bash |
| run: | |
| set -x |
| python3 ${GITHUB_WORKSPACE}/tools/create_archive.py -x -s ${GITHUB_WORKSPACE}/out/tmp/${COBALT_EVERGREEN_LOADER}_${{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 "XML_FILES_DIR=${GITHUB_WORKSPACE}/unit-test-results/${{ matrix.platform }}/${{ matrix.shard }}" >> $GITHUB_ENV |
| echo "COVERAGE_DIR=${GITHUB_WORKSPACE}/coverage" >> $GITHUB_ENV |
| - name: Run Tests |
| id: run-tests |
| shell: bash |
| run: | |
| set -x |
| |
| # Starboard toolchains are downloaded to a different dir on github. Create a symlink to reassure our tooling that everything is fine. |
| if [ -d /root/starboard-toolchains ]; then |
| ln -s /root/starboard-toolchains /github/home/starboard-toolchains |
| fi |
| loader_args='' |
| if [ "${COBALT_EVERGREEN_LOADER}" != "null" ]; then |
| loader_args="--loader_platform ${COBALT_EVERGREEN_LOADER} --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 |
| elif [[ "${{matrix.shard}}" == 'coverage' ]]; then |
| 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}} -r ${loader_args} --xml_output_dir=${XML_FILES_DIR} --coverage_dir=${COVERAGE_DIR} --coverage_report |
| else |
| # Set 'test_type' output to unit_tests for the upload steps below. |
| echo "test_type=unit_tests" >> $GITHUB_OUTPUT |
| 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 --xml_output_dir=${XML_FILES_DIR} |
| 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=${XML_FILES_DIR} |
| fi |
| fi |
| - name: Populate TAGS for unit test report |
| if: (success() || failure()) && steps.run-tests.outputs.test_type == 'unit_tests' |
| shell: bash |
| run: | |
| # Set tags for test differentiation. |
| tags="platform:${{ matrix.platform }}" |
| tags="${tags},os:${{ inputs.os }}" |
| echo $tags > ${TEST_RESULTS_DIR}/${{ matrix.platform }}/TAGS |
| - name: Archive unit test results |
| uses: actions/upload-artifact@v3 |
| if: (success() || failure()) && steps.run-tests.outputs.test_type == 'unit_tests' |
| with: |
| name: unit-test-results |
| path: ${{env.TEST_RESULTS_DIR}}/ |
| - name: Archive coverage html report |
| if: success() && matrix.shard == 'coverage' |
| uses: actions/upload-artifact@v3 |
| with: |
| name: coverage-report |
| path: ${{env.COVERAGE_DIR}}/html |
| - name: Upload to Codecov |
| if: success() && matrix.shard == 'coverage' |
| uses: codecov/codecov-action@v3 |
| with: |
| files: ${{env.COVERAGE_DIR}}/report.txt |