Skip to content

Commit 08538a8

Browse files
feat: replace docker cp with a mounted volume in build (#47)
* feat: replace `docker cp` with mounted volume Co-authored-by: Kyle a.k.a. TechSquidTV <[email protected]>
1 parent 9e3457d commit 08538a8

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
<!-- please check all items and add your own -->
88

9-
- [x] Read the contribution [guide](../blob/main/CONTRIBUTING.md) and accept the [code](../blob/main/CODE_OF_CONDUCT.md) of conduct
9+
- [x] Read the contribution [guide](/game-ci/unity-orb/blob/main/CONTRIBUTING.md) and accept the [code](/game-ci/unity-orb/blob/main/CODE_OF_CONDUCT.md) of conduct
1010
- [ ] Documentation (updated or not needed)
1111
- [ ] Tests (added, updated or not needed)

src/scripts/windows/build.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ trap_exit() {
1616
}
1717
trap trap_exit EXIT
1818

19-
# Create the build folder
20-
docker exec "$CONTAINER_NAME" powershell mkdir C:/build
21-
2219
# Add the build target and build name in the environment variables.
2320
docker exec "$CONTAINER_NAME" powershell "[System.Environment]::SetEnvironmentVariable('BUILD_NAME','$PARAM_BUILD_NAME', [System.EnvironmentVariableTarget]::Machine)"
2421
docker exec "$CONTAINER_NAME" powershell "[System.Environment]::SetEnvironmentVariable('BUILD_TARGET','$PARAM_BUILD_TARGET', [System.EnvironmentVariableTarget]::Machine)"
@@ -53,8 +50,12 @@ if [ "$exit_code" -ne 0 ]; then
5350
exit "$exit_code"
5451
fi
5552

56-
# Compress the build folder.
57-
docker exec "$CONTAINER_NAME" powershell 'tar -czf "C:/$Env:BUILD_NAME-$Env:BUILD_TARGET.tar.gz" -C "C:/build" .'
53+
printf '%s\n' "Build completed successfully:"
54+
ls -la "$base_dir/build"
5855

59-
# Copy the build directory to the host.
60-
docker cp "$CONTAINER_NAME":"$PARAM_BUILD_NAME"-"$PARAM_BUILD_TARGET".tar.gz "$base_dir"/"$PARAM_BUILD_TARGET".tar.gz
56+
if [ "$PARAM_COMPRESS" -eq 1 ]; then
57+
printf '%s\n' "Compressing artifacts..."
58+
tar -czf "$base_dir/${PARAM_BUILD_TARGET}.tar.gz" -C "$base_dir/build" .
59+
printf '%s\n' "Done."
60+
ls -la "$base_dir"
61+
fi

src/scripts/windows/prepare-env.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ if ! resolve_unity_serial; then
9393
exit 1
9494
fi
9595

96+
# Create folder to store the build artifacts.
97+
mkdir -p "$base_dir/build" || { echo "Unable to create the build directory"; exit 1; }
98+
9699
set -x
97100

98101
# Run the container and prevent it from exiting.
@@ -105,6 +108,7 @@ docker run -dit \
105108
--env UNITY_SERIAL="$resolved_unity_serial" \
106109
--volume "$unity_project_full_path":C:/unity_project \
107110
--volume "$base_dir"/regkeys:"C:/regkeys" \
111+
--volume "$base_dir"/build:"C:/build" \
108112
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
109113
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
110114
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio" \
@@ -118,4 +122,4 @@ docker exec "$container_name" powershell 'reg import C:\regkeys\winsdk.reg'
118122
docker exec "$container_name" powershell 'regsvr32 /s C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll'
119123

120124
# Activate Unity
121-
docker exec "$container_name" powershell '& "C:\Program Files\Unity\Hub\Editor\*\Editor\Unity.exe" -batchmode -quit -nographics -username $Env:UNITY_USERNAME -password $Env:UNITY_PASSWORD -serial $Env:UNITY_SERIAL -logfile | Out-Host'
125+
docker exec "$container_name" powershell '& "C:\Program Files\Unity\Hub\Editor\*\Editor\Unity.exe" -batchmode -quit -nographics -username $Env:UNITY_USERNAME -password $Env:UNITY_PASSWORD -serial $Env:UNITY_SERIAL -logfile | Out-Host'

0 commit comments

Comments
 (0)