build: upload separate artifact for src files (#42486)

This commit is contained in:
Shelley Vohr 2024-06-13 16:35:13 -05:00 committed by GitHub
parent a0a8bd2222
commit 9fe1b05025
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 12 deletions

View file

@ -184,4 +184,9 @@ runs:
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: generated_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}
- name: Upload Src Artifacts ${{ inputs.step-suffix }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: src_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}
path: ./src_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}

View file

@ -81,6 +81,11 @@ jobs:
with:
name: generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
- name: Download Src Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
name: src_artifacts_${{ matrix.build-type }}_${{ env.TARGET_ARCH }}
path: ./src_artifacts_${{ matrix.build-type }}_${{ env.TARGET_ARCH }}
- name: Restore Generated Artifacts
run: ./src/electron/script/actions/restore-artifacts.sh
- name: Unzip Dist, Mksnapshot & Chromedriver

View file

@ -75,6 +75,11 @@ jobs:
with:
name: generated_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_linux_${{ env.TARGET_ARCH }}
- name: Download Src Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
- name: Restore Generated Artifacts
run: ./src/electron/script/actions/restore-artifacts.sh
- name: Unzip Dist
@ -134,6 +139,11 @@ jobs:
with:
name: generated_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_linux_${{ env.TARGET_ARCH }}
- name: Download Src Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
- name: Restore Generated Artifacts
run: ./src/electron/script/actions/restore-artifacts.sh
- name: Unzip Dist

View file

@ -19,6 +19,12 @@ echo Creating $GENERATED_ARTIFACTS...
rm -rf $GENERATED_ARTIFACTS
mkdir $GENERATED_ARTIFACTS
SRC_ARTIFACTS="src_artifacts_${BUILD_TYPE}_${TARGET_ARCH}"
echo Creating $SRC_ARTIFACTS...
rm -rf $SRC_ARTIFACTS
mkdir $SRC_ARTIFACTS
mv_if_exist() {
if [ -f "$1" ] || [ -d "$1" ]; then
echo Storing $1
@ -37,8 +43,8 @@ cp_if_exist() {
fi
}
tar_src_dirs_if_exist() {
mkdir build_artifacts
move_src_dirs_if_exist() {
mkdir src_artifacts
for dir in \
src/out/Default/gen/node_headers \
@ -60,14 +66,15 @@ tar_src_dirs_if_exist() {
src/v8/tools/builtins-pgo
do
if [ -d "$dir" ]; then
mkdir -p build_artifacts/$(dirname $dir)
cp -r $dir/ build_artifacts/$dir
mkdir -p src_artifacts/$(dirname $dir)
cp -r $dir/ src_artifacts/$dir
fi
done
tar -C build_artifacts -cf build_artifacts.tar ./
tar -C src_artifacts -cf src_artifacts.tar ./
mv_if_exist build_artifacts.tar
echo Storing src_artifacts.tar
mv src_artifacts.tar $SRC_ARTIFACTS
}
# Generated Artifacts
@ -82,4 +89,4 @@ mv_if_exist src/cross-arch-snapshots
cp_if_exist src/out/electron_ninja_log
cp_if_exist src/out/Default/.ninja_log
tar_src_dirs_if_exist
move_src_dirs_if_exist

View file

@ -14,6 +14,7 @@ else
fi
GENERATED_ARTIFACTS="generated_artifacts_${BUILD_TYPE}_${TARGET_ARCH}"
SRC_ARTIFACTS="src_artifacts_${BUILD_TYPE}_${TARGET_ARCH}"
mv_if_exist() {
if [ -f "${GENERATED_ARTIFACTS}/$1" ] || [ -d "${GENERATED_ARTIFACTS}/$1" ]; then
@ -26,9 +27,9 @@ mv_if_exist() {
}
untar_if_exist() {
if [ -f "${GENERATED_ARTIFACTS}/$1" ] || [ -d "${GENERATED_ARTIFACTS}/$1" ]; then
if [ -f "${SRC_ARTIFACTS}/$1" ] || [ -d "${SRC_ARTIFACTS}/$1" ]; then
echo Restoring $1 to current directory
tar -xf ${GENERATED_ARTIFACTS}/$1
tar -xf ${SRC_ARTIFACTS}/$1
else
echo Skipping $1 - It is not present on disk
fi
@ -46,5 +47,7 @@ mv_if_exist ffmpeg.zip src/out/ffmpeg
mv_if_exist hunspell_dictionaries.zip src/out/Default
mv_if_exist cross-arch-snapshots src
# Restore build artifacts
untar_if_exist build_artifacts.tar
echo Restoring artifacts from $SRC_ARTIFACTS
# Restore src artifacts
untar_if_exist src_artifacts.tar