Skip to content

Commit bafd63e

Browse files
authored
feat: change build name default (#24)
* feat: allow blank for the `build-name` parameter * fix: remove build name from compress * fix: compress * chore: add docs links to error messages * fix: test script in the Windows executor
1 parent 4bbb1ad commit bafd63e

File tree

11 files changed

+24
-10
lines changed

11 files changed

+24
-10
lines changed

src/@orb.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version: 2.1
22

33
description: >
4-
Easily build and test Unity projects. The project artifacts and test results are stored in CircleCI and can be opened in the Workflow dashboard.
5-
Supports Linux x86_64.
4+
Easily build and test Unity projects. The project artifacts and test results are stored in CircleCI and can be opened in the Workflow web app.
5+
Supports Windows, Linux and macOS.
66
77
display:
8-
home_url: "https://game.ci/docs/"
8+
home_url: "https://game.ci/docs/circleci/getting-started"
99
source_url: "https://github.com/game-ci/unity-orb"

src/commands/build.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ parameters:
2020
Accepted arguments vary with Unity's version and can be found in the docs: https://docs.unity3d.com/2021.2/Documentation/ScriptReference/BuildTarget.html
2121
build-name:
2222
type: string
23-
default: "UnityBuild"
23+
default: ""
2424
description: |
2525
Enter the name for this build.
26+
If left blank, the build will be named after the target platform.
2627
cache-version:
2728
type: string
2829
default: "v1"
@@ -63,7 +64,7 @@ steps:
6364
condition: << parameters.compress >>
6465
steps:
6566
- store_artifacts:
66-
path: << parameters.build-name >>-<< parameters.build-target >>.tar.gz
67+
path: << parameters.build-target >>.tar.gz
6768
- unless:
6869
condition: << parameters.compress >>
6970
steps:

src/jobs/build.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ parameters:
4646
Accepted arguments vary with Unity's version and can be found in the docs: https://docs.unity3d.com/2022.2/Documentation/ScriptReference/BuildTarget.html
4747
build-name:
4848
type: string
49-
default: "UnityBuild"
49+
default: ""
5050
description: |
5151
Enter the name for this build.
52+
If left blank, the build will be named after the target platform.
5253
compress:
5354
type: boolean
5455
default: true

src/scripts/build.sh

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ detect-os
1313
mkdir -p "$unity_project_full_path/Assets/Editor/"
1414
printf '%s\n' "$DEPENDENCY_UNITY_BUILDER" > "$unity_project_full_path/Assets/Editor/BuildCommand.cs"
1515

16+
# If "build_name" is blank, use the build target.
17+
if [ -z "$PARAM_BUILD_NAME" ]; then PARAM_BUILD_NAME="$PARAM_BUILD_TARGET"; fi
18+
1619
if [ "$PLATFORM" = "linux" ]; then eval "$SCRIPT_BUILD_LINUX";
1720
elif [ "$PLATFORM" = "macos" ]; then eval "$SCRIPT_BUILD_MACOS";
1821
elif [ "$PLATFORM" = "windows" ]; then eval "$SCRIPT_BUILD_WINDOWS";

src/scripts/linux/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trap_build_script_exit() {
1818
printf '%s\n' 'Compressing build artifacts...'
1919

2020
# Compress artifacts to store them in the artifacts bucket.
21-
tar -czf "$base_dir/$PARAM_BUILD_NAME-$PARAM_BUILD_TARGET.tar.gz" -C "$unity_project_full_path/Builds/$PARAM_BUILD_TARGET" .
21+
tar -czf "$base_dir/$PARAM_BUILD_TARGET.tar.gz" -C "$unity_project_full_path/Builds/$PARAM_BUILD_TARGET" .
2222
fi
2323
}
2424

src/scripts/linux/prepare-env.sh

+2
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ resolve_unity_license() {
3636
printf '%s\n' "Failed to generate Unity license file."
3737
printf '%s\n' "Make sure you have entered the correct username, password and serial and try again."
3838
printf '%s\n' "If you are still having problems, please open an issue."
39+
printf '%s\n' "See the docs for more details: https://game.ci/docs/circleci/activation#professional-license"
3940

4041
return 1
4142
fi
4243

4344
else
4445
printf '%s\n' "If you own a Personal Unity License File (.ulf), please provide it as a base64 encoded string."
4546
printf '%s\n' "If you own a Plus or Pro Unity license, please provide your username, password and serial."
47+
printf '%s\n' "See the docs for more details: https://game.ci/docs/circleci/activation"
4648

4749
if create_manual_activation_file; then
4850
printf '%s\n' "Should you require a new Personal Activation License File (.alf), rerun the job with SSH and you will find it at \"${base_dir}/$(ls Unity_v*)\""

src/scripts/macos/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ if [ "$PARAM_COMPRESS" -eq 1 ]; then
2525
printf '%s\n' 'Compressing build artifacts...'
2626

2727
# Compress artifacts to store them in the artifacts bucket.
28-
tar -czf "$base_dir/$PARAM_BUILD_NAME-$PARAM_BUILD_TARGET.tar.gz" -C "$build_path" .
28+
tar -czf "$base_dir/$PARAM_BUILD_TARGET.tar.gz" -C "$build_path" .
2929
fi

src/scripts/macos/prepare-env.sh

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ resolve_unity_serial() {
7878
if ! extract_serial_from_license; then
7979
printf '%s\n' "Failed to parse the serial from the Unity license."
8080
printf '%s\n' "Please try again or open an issue."
81+
printf '%s\n' "See the docs for more details: https://game.ci/docs/circleci/activation#personal-license"
8182
return 1
8283

8384
else
@@ -88,6 +89,7 @@ resolve_unity_serial() {
8889
else
8990
printf '%s\n' "No serial or encoded license found."
9091
printf '%s\n' "Please run the script again with a serial or encoded license file."
92+
printf '%s\n' "See the docs for more details: https://game.ci/docs/circleci/activation"
9193
return 1
9294
fi
9395
fi

src/scripts/windows/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ docker exec "$CONTAINER_NAME" powershell '& "C:\Program Files\Unity\Hub\Editor\*
3232
docker exec "$CONTAINER_NAME" powershell 'tar -czf "C:/$Env:BUILD_NAME-$Env:BUILD_TARGET.tar.gz" -C "C:/build" .'
3333

3434
# Copy the build directory to the host.
35-
docker cp "$CONTAINER_NAME":"$PARAM_BUILD_NAME"-"$PARAM_BUILD_TARGET".tar.gz "$base_dir"/"$PARAM_BUILD_NAME"-"$PARAM_BUILD_TARGET".tar.gz
35+
docker cp "$CONTAINER_NAME":"$PARAM_BUILD_NAME"-"$PARAM_BUILD_TARGET".tar.gz "$base_dir"/"$PARAM_BUILD_TARGET".tar.gz

src/scripts/windows/prepare-env.sh

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ resolve_unity_serial() {
3232
if ! extract_serial_from_license; then
3333
printf '%s\n' "Failed to parse the serial from the Unity license."
3434
printf '%s\n' "Please try again or open an issue."
35+
printf '%s\n' "See the docs for more details: https://game.ci/docs/circleci/activation#personal-license"
36+
3537
exit_code=1
3638

3739
else
@@ -42,6 +44,8 @@ resolve_unity_serial() {
4244
else
4345
printf '%s\n' "No serial or encoded license found."
4446
printf '%s\n' "Please run the script again with a serial or encoded license file."
47+
printf '%s\n' "See the docs for more details: https://game.ci/docs/circleci/activation"
48+
4549
exit_code=1
4650
fi
4751
fi

src/scripts/windows/test.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ docker exec "$CONTAINER_NAME" powershell 'Invoke-WebRequest -Uri "https://versaw
3030
docker exec "$CONTAINER_NAME" powershell "Expand-Archive -Force C:/saxonb.zip C:/saxonb"
3131

3232
# Copy the Saxon-B template to the container.
33-
docker cp "$gameci_sample_project_dir"/ci/nunit-transforms/nunit3-junit.xslt "$CONTAINER_NAME":C:/nunit3-junit.xslt
33+
printf '%s\n' "$DEPENDENCY_NUNIT_TRANSFORM" > "$base_dir/nunit3-junit.xslt"
34+
docker cp "$base_dir"/nunit3-junit.xslt "$CONTAINER_NAME":C:/nunit3-junit.xslt
3435

3536
# Parse Unity's results xml to JUnit format.
3637
docker exec "$CONTAINER_NAME" powershell 'java -jar C:/saxonb/saxon9.jar -s C:/results.xml -xsl C:/nunit3-junit.xslt > C:/$Env:TEST_PLATFORM-junit-results.xml'

0 commit comments

Comments
 (0)