diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 9afbc8e..576b2c3 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -51,6 +51,29 @@ pre-steps: # Move the demo project to the project folder mv ../Unity2D-Demo-Game-CI-CD ./Unity2D-Demo-Game-CI-CD +jobs: + test-persist-to-workspace: + docker: + - image: cimg/base:2023.06 + steps: + - checkout + - attach_workspace: + at: . + - run: + name: Check attached file exists + command: ls Builds/StandaloneLinux64/UnityPlayer.so + + test-compress-persist-to-workspace: + docker: + - image: cimg/base:2023.06 + steps: + - checkout + - attach_workspace: + at: . + - run: + name: Check attached file exists + command: ls StandaloneLinux64.tar.gz + workflows: test-build: jobs: @@ -353,6 +376,48 @@ workflows: filters: *filters context: orb-testing-unity pre-steps: *custom-build-method + - unity/build: + name: "build-with-workspace" + step-name: "Build StandaloneLinux64 with workspace" + unity-license-var-name: "UNITY_ENCODED_LICENSE_2021" + unity-username-var-name: "UNITY_USERNAME" + unity-password-var-name: "UNITY_PASSWORD" + executor: + name: "unity/ubuntu" + target_platform: "base" + editor_version: "2021.3.1f1" + resource_class: "large" + project-path: "Unity2D-Demo-Game-CI-CD/src" + build-target: StandaloneLinux64 + compress: false + persist-to-workspace: true + filters: *filters + context: orb-testing-unity + pre-steps: *mono + - test-persist-to-workspace: + requires: + - build-with-workspace + - unity/build: + name: "compress-build-with-workspace" + step-name: "Compress build StandaloneLinux64 with workspace" + unity-license-var-name: "UNITY_ENCODED_LICENSE_2021" + unity-username-var-name: "UNITY_USERNAME" + unity-password-var-name: "UNITY_PASSWORD" + executor: + name: "unity/ubuntu" + target_platform: "base" + editor_version: "2021.3.1f1" + resource_class: "large" + project-path: "Unity2D-Demo-Game-CI-CD/src" + build-target: StandaloneLinux64 + compress: true + persist-to-workspace: true + filters: *filters + context: orb-testing-unity + pre-steps: *mono + - test-compress-persist-to-workspace: + requires: + - compress-build-with-workspace - orb-tools/pack: filters: *release-filters diff --git a/src/commands/build.yml b/src/commands/build.yml index 041e98c..fd81ef7 100644 --- a/src/commands/build.yml +++ b/src/commands/build.yml @@ -47,6 +47,10 @@ parameters: Whether to compress the build output to a ".tar.gz" archive. This is recommended if you want to download the built artifacts from the CircleCI web app. If left to "false" for decompressed WebGL builds, you can run the project directly from the CircleCI web app. + persist-to-workspace: + type: boolean + default: false + description: Whether to persist the build output to workspace. no_output_timeout: type: string default: "10m" @@ -105,3 +109,25 @@ steps: steps: - store_artifacts: path: << parameters.project-path >>/Builds/<< parameters.build-target >> + + - when: + condition: + and: + - << parameters.persist-to-workspace >> + - << parameters.compress >> + steps: + - persist_to_workspace: + root: . + paths: + - << parameters.build-target >>.tar.gz + + - when: + condition: + and: + - << parameters.persist-to-workspace >> + - not: << parameters.compress >> + steps: + - persist_to_workspace: + root: << parameters.project-path >> + paths: + - Builds/<< parameters.build-target >> diff --git a/src/jobs/build.yml b/src/jobs/build.yml index 00fc686..9170c0f 100755 --- a/src/jobs/build.yml +++ b/src/jobs/build.yml @@ -63,6 +63,10 @@ parameters: Whether to compress the build output to a ".tar.gz" archive. This is recommended if you want to download the built artifacts from the CircleCI web app. If left to "false" for decompressed WebGL builds, you can run the project directly from the CircleCI web app. + persist-to-workspace: + type: boolean + default: false + description: Whether to persist the build output to workspace. return-license: type: boolean default: false @@ -118,6 +122,7 @@ steps: project-path: <> store-artifacts: <> compress: <> + persist-to-workspace: <> no_output_timeout: << parameters.no_output_timeout>> build-method: <> custom-parameters: <>