17ec681f3Smrg#!/bin/bash
27ec681f3Smrg
37ec681f3Smrgset -e
47ec681f3Smrgset -o xtrace
57ec681f3Smrg
67ec681f3SmrgCROSS_FILE=/cross_file-"$CROSS".txt
77ec681f3Smrg
87ec681f3Smrg# Delete unused bin and includes from artifacts to save space.
97ec681f3Smrgrm -rf install/bin install/include
107ec681f3Smrg
117ec681f3Smrg# Strip the drivers in the artifacts to cut 80% of the artifacts size.
127ec681f3Smrgif [ -n "$CROSS" ]; then
137ec681f3Smrg    STRIP=`sed -n -E "s/strip\s*=\s*'(.*)'/\1/p" "$CROSS_FILE"`
147ec681f3Smrg    if [ -z "$STRIP" ]; then
157ec681f3Smrg        echo "Failed to find strip command in cross file"
167ec681f3Smrg        exit 1
177ec681f3Smrg    fi
187ec681f3Smrgelse
197ec681f3Smrg    STRIP="strip"
207ec681f3Smrgfi
217ec681f3Smrgif [ -z "$ARTIFACTS_DEBUG_SYMBOLS" ]; then
227ec681f3Smrg    find install -name \*.so -exec $STRIP {} \;
237ec681f3Smrgfi
247ec681f3Smrg
257ec681f3Smrg# Test runs don't pull down the git tree, so put the dEQP helper
267ec681f3Smrg# script and associated bits there.
277ec681f3Smrgecho "$(cat VERSION) (git-$(git rev-parse HEAD | cut -b -10))" > install/VERSION
287ec681f3Smrgcp -Rp .gitlab-ci/bare-metal install/
297ec681f3Smrgcp -Rp .gitlab-ci/common install/
307ec681f3Smrgcp -Rp .gitlab-ci/piglit install/
317ec681f3Smrgcp -Rp .gitlab-ci/fossils.yml install/
327ec681f3Smrgcp -Rp .gitlab-ci/fossils install/
337ec681f3Smrgcp -Rp .gitlab-ci/fossilize-runner.sh install/
347ec681f3Smrgcp -Rp .gitlab-ci/crosvm-init.sh install/
357ec681f3Smrgcp -Rp .gitlab-ci/*.txt install/
367ec681f3Smrgcp -Rp .gitlab-ci/report-flakes.py install/
377ec681f3Smrgcp -Rp .gitlab-ci/vkd3d-proton install/
387ec681f3Smrgcp -Rp .gitlab-ci/*-runner.sh install/
397ec681f3Smrgfind . -path \*/ci/\*.txt \
407ec681f3Smrg    -o -path \*/ci/\*.toml \
417ec681f3Smrg    -o -path \*/ci/\*traces\*.yml \
427ec681f3Smrg    | xargs -I '{}' cp -p '{}' install/
437ec681f3Smrg
447ec681f3Smrg# Tar up the install dir so that symlinks and hardlinks aren't each
457ec681f3Smrg# packed separately in the zip file.
467ec681f3Smrgmkdir -p artifacts/
477ec681f3Smrgtar -cf artifacts/install.tar install
487ec681f3Smrgcp -Rp .gitlab-ci/common artifacts/ci-common
497ec681f3Smrgcp -Rp .gitlab-ci/lava artifacts/
507ec681f3Smrg
517ec681f3Smrgif [ -n "$MINIO_ARTIFACT_NAME" ]; then
527ec681f3Smrg    # Pass needed files to the test stage
537ec681f3Smrg    MINIO_ARTIFACT_NAME="$MINIO_ARTIFACT_NAME.tar.gz"
547ec681f3Smrg    gzip -c artifacts/install.tar > ${MINIO_ARTIFACT_NAME}
557ec681f3Smrg    ci-fairy minio login $CI_JOB_JWT
567ec681f3Smrg    ci-fairy minio cp ${MINIO_ARTIFACT_NAME} minio://${PIPELINE_ARTIFACTS_BASE}/${MINIO_ARTIFACT_NAME}
577ec681f3Smrgfi
58