Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter persist-to-workspace in Build command and job #55

Merged
merged 9 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions src/commands/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 >>
5 changes: 5 additions & 0 deletions src/jobs/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -118,6 +122,7 @@ steps:
project-path: <<parameters.project-path>>
store-artifacts: <<parameters.store-artifacts>>
compress: <<parameters.compress>>
persist-to-workspace: <<parameters.persist-to-workspace>>
no_output_timeout: << parameters.no_output_timeout>>
build-method: <<parameters.build-method>>
custom-parameters: <<parameters.custom-parameters>>
Expand Down