blob: 33eaa063fc0f3caf620c6e192f5b49c5a2deb551 [file] [log] [blame]
name: Test Artifact Upload
description: Uploads test archives to GCS and runs on-device tests.
inputs:
type:
description: "Type of artifacts to upload (ondevice or onhost)"
required: true
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
env:
WORKFLOW: ${{ github.workflow }}
run: |
set -x
project_name=$(gcloud config get-value project)
if [ -z ${COBALT_EVERGREEN_LOADER+x} ]
then
PLATFORM=${{matrix.platform}}
echo "TARGET_PLATFORM=${{matrix.target_platform}}" >> $GITHUB_ENV
else
PLATFORM=${COBALT_EVERGREEN_LOADER}
echo "TARGET_PLATFORM=${COBALT_EVERGREEN_LOADER}" >> $GITHUB_ENV
fi
if [ "${{ inputs.type }}" == 'ondevice' ]
then
echo "ARCHIVE_FILE=artifacts.tar" >> $GITHUB_ENV
echo "ARCHIVE_PATH=$GITHUB_WORKSPACE/artifacts.tar" >> $GITHUB_ENV
echo "DESTINATION=${project_name}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{matrix.platform}}_${{matrix.config}}/" >> $GITHUB_ENV
elif [ "${{ inputs.type }}" == 'onhost' ]
then
if [ "${{ inputs.os }}" == 'linux' ]
then
echo "ARCHIVE_FILE=${PLATFORM}_${{matrix.config}}.tar.xz" >> $GITHUB_ENV
echo "ARCHIVE_PATH=$GITHUB_WORKSPACE/${PLATFORM}_${{matrix.config}}.tar.xz" >> $GITHUB_ENV
elif [ "${{ inputs.os }}" == 'windows' ]
then
echo "ARCHIVE_FILE=${PLATFORM}_${{matrix.config}}.tar.gz" >> $GITHUB_ENV
echo "ARCHIVE_PATH=$GITHUB_WORKSPACE/${PLATFORM}_${{matrix.config}}.tar.gz" >> $GITHUB_ENV
fi
echo "DESTINATION=${project_name}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{matrix.platform}}_${{matrix.config}}/" >> $GITHUB_ENV
fi
echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
project_name=$(gcloud config get-value project)
shell: bash
- name: Create Test Files Archive
run: |
set -x
[ -f "${ARCHIVE_PATH}" ] && rm -rf "${ARCHIVE_PATH}"
if [ "${{ inputs.type }}" == 'ondevice' ]
then
outdir="$GITHUB_WORKSPACE/out/${{matrix.target_platform}}_${{matrix.config}}"
if [ -n "${COBALT_EVERGREEN_LOADER}" ]
then
outdir="${outdir} $GITHUB_WORKSPACE/out/${COBALT_EVERGREEN_LOADER}_${{matrix.config}}"
fi
python3 $GITHUB_WORKSPACE/tools/create_archive.py --test_infra -d ${{env.ARCHIVE_FILE}} -s ${outdir}
elif [ "${{ inputs.type }}" == 'onhost' ]
then
parallel=
if [[ "${{inputs.os}}" == 'linux' ]]; then
parallel='--parallel'
fi
python3 $GITHUB_WORKSPACE/tools/create_archive.py --intermediate -d ${{env.ARCHIVE_FILE}} -s $GITHUB_WORKSPACE/out/${TARGET_PLATFORM}_${{matrix.config}} $parallel
fi
shell: bash
- name: Copy Test Files to GCS
id: upload-test-archive
shell: bash
run: |
set -eux
gsutil -d cp "${ARCHIVE_PATH}" "gs://${DESTINATION}"