From 183880d7648ad12ba40be437ecad31c7306d88d7 Mon Sep 17 00:00:00 2001 From: Lachee Date: Sun, 21 Sep 2025 18:52:34 +1000 Subject: [PATCH] [no ci] tweaked modules to be individual steps --- .gitignore | 3 +- README.md | 37 ++++++++++---- dockerfiles/runner.dockerfile | 90 ++++++++++++++++++++--------------- make-local-container.sh | 4 ++ scripts/install-module.sh | 18 +++++++ 5 files changed, 104 insertions(+), 48 deletions(-) create mode 100644 make-local-container.sh create mode 100644 scripts/install-module.sh diff --git a/.gitignore b/.gitignore index d692d6f..9480fe0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -gameci \ No newline at end of file +gameci +test \ No newline at end of file diff --git a/README.md b/README.md index 88d331f..153ac44 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,33 @@ A table of available Docker images for Unity CI/CD: |6000.0.35f1|[🐳 View](https://docker.lakes.house/repo/unityci/editor/tag/ubuntu-6000.0.35f1-runner)
📦 15.66 GB|[🐳 View](https://docker.lakes.house/repo/unityci/editor/tag/ubuntu-6000.0.35f1-android-runner)
📦 12.02 GB|[🐳 View](https://docker.lakes.house/repo/unityci/editor/tag/ubuntu-6000.0.35f1-ios-runner)
📦 10.47 GB|[🐳 View](https://docker.lakes.house/repo/unityci/editor/tag/ubuntu-6000.0.35f1-linux-il2cpp-runner)
📦 10.37 GB|[🐳 View](https://docker.lakes.house/repo/unityci/editor/tag/ubuntu-6000.0.35f1-mac-mono-runner)
📦 10.70 GB|[🐳 View](https://docker.lakes.house/repo/unityci/editor/tag/ubuntu-6000.0.35f1-webgl-runner)
📦 11.60 GB|[🐳 View](https://docker.lakes.house/repo/unityci/editor/tag/ubuntu-6000.0.35f1-windows-mono-runner)
📦 11.07 GB| +# Included Software +**Tools** +- Unity3D (as `unity-editor`) +- Blender `3.4` +- CMake +- CURL +- GCC +- Git +- Make +- Zip & Unzip + +**Language and Runtime** +- Bash `5.1.16(1)-release` +- Node.js `20.19.5` +- Python3 `3.10.12` +- lib-sqlite3 +- libssl + +**Package Management** +- NPM `11.6.0` +- PNPM `10.17.0` +- pip3 `22.0.2` + + +**SDKs** +- AWS CLI +- Azure SDK + # Usage - - - -TODO: -https://github.com/mob-sakai/unity-changeset/blob/main/src/unityGraphQL.ts - -use this library to get the change set. -Might as well orchestrate the build with it too. \ No newline at end of file +... \ No newline at end of file diff --git a/dockerfiles/runner.dockerfile b/dockerfiles/runner.dockerfile index 189ebe8..42341a7 100644 --- a/dockerfiles/runner.dockerfile +++ b/dockerfiles/runner.dockerfile @@ -11,28 +11,29 @@ FROM $HUB_IMAGE AS builder ARG VERSION COPY --from=editor "$UNITY_PATH/" /opt/unity/editors/$VERSION/ +# Install CMake +RUN apt-get update && apt-get install -y cmake +COPY scripts/install-module.sh /bin/install-module + # Install modules for that editor -ARG MODULE="non-existent-module" -RUN for mod in $MODULE; do \ - if [ "$mod" = "base" ] ; then \ - echo "running default modules for this baseOs"; \ - else \ - unity-hub install-modules --version "$VERSION" --module "$mod" --childModules | tee /var/log/install-module-${mod}.log && \ - grep 'Missing module\|Completed with errors' /var/log/install-module-${mod}.log | exit $(wc -l); \ - fi \ - done \ - # Set execute permissions for modules - && chmod -R 755 /opt/unity/editors/$VERSION/Editor/Data/PlaybackEngines - -RUN echo "$VERSION-$MODULE" | grep -q -vP '^(2021.2.(?![0-4](?![0-9]))|2021.[3-9]|202[2-9]|[6-9][0-9]{3}|[1-9][0-9]{4,}).*linux' \ - && exit 0 \ - || unity-hub install-modules --version "$VERSION" --module "linux-server" --childModules | \ - tee /var/log/install-module-linux-server.log && grep 'Missing module' /var/log/install-module-linux-server.log | exit $(wc -l); - -RUN echo "$VERSION-$MODULE" | grep -q -vP '^(2021.2.(?![0-4](?![0-9]))|2021.[3-9]|202[2-9]|[6-9][0-9]{3}|[1-9][0-9]{4,}).*windows' \ - && exit 0 \ - || unity-hub install-modules --version "$VERSION" --module "windows-server" --childModules | \ - tee /var/log/install-module-windows-server.log && grep 'Missing module' /var/log/install-module-windows-server.log | exit $(wc -l); +ARG MODULE +RUN install-module "$VERSION" "$MODULE" android +RUN install-module "$VERSION" "$MODULE" ios +RUN install-module "$VERSION" "$MODULE" appletv +RUN install-module "$VERSION" "$MODULE" linux-mono +RUN install-module "$VERSION" "$MODULE" linux-il2cpp +RUN install-module "$VERSION" "$MODULE" webgl +RUN install-module "$VERSION" "$MODULE" windows +RUN install-module "$VERSION" "$MODULE" vuforia-ar +RUN install-module "$VERSION" "$MODULE" windows-mono +RUN install-module "$VERSION" "$MODULE" lumin +RUN install-module "$VERSION" "$MODULE" mac-mono +RUN install-module "$VERSION" "$MODULE" mac-il2cpp +RUN install-module "$VERSION" "$MODULE" universal-windows-platform +RUN install-module "$VERSION" "$MODULE" uwp-il2cpp +RUN install-module "$VERSION" "$MODULE" uwp-.net +RUN install-module "$VERSION" "$MODULE" linux-server +RUN install-module "$VERSION" "$MODULE" windows-server ########################### # Editor # @@ -45,28 +46,21 @@ ARG MODULE COPY --from=builder /opt/unity/editors/$VERSION/ "$UNITY_PATH/" RUN echo $VERSION > "$UNITY_PATH/version" +# Tools RUN apt-get update && \ apt-get install -y \ - git \ + build-essential \ + cmake \ curl \ gcc \ - make \ + git \ + libsqlite3-dev \ libssl-dev \ + make \ + pkg-config \ zlib1g-dev \ - libsqlite3-dev + zip unzip -# Set up the scripts -RUN git clone --depth=1 https://github.com/game-ci/unity-builder.git /gameci && \ - cp -rf /gameci/dist/platforms/ubuntu/steps /steps && \ - cp -rf /gameci/dist/default-build-script /UnityBuilderAction && \ - cp /gameci/dist/platforms/ubuntu/entrypoint.sh /entrypoint.sh - -# Set up Node.js environment for github actions -RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ - apt-get install -y nodejs && \ - npm install -g npm@latest - -# Install Blender ARG BLENDER_SHORT_VERSION=3.4 ARG BLENDER_FULL_VERSION=3.4.1 RUN echo "BLENDER_FULL_VERSION: $BLENDER_FULL_VERSION" && \ @@ -77,7 +71,25 @@ RUN echo "BLENDER_FULL_VERSION: $BLENDER_FULL_VERSION" && \ rm blender-$BLENDER_FULL_VERSION-linux-x64.tar.xz ENV PATH="$PATH:/blender-$BLENDER_FULL_VERSION-linux-x64" -# Add custom scripts +# Runtimes, Languages, & Package Managers +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ + apt-get install -y nodejs && npm install -g npm@latest +RUN curl -fsSL https://get.pnpm.io/install.sh | bash - +RUN apt-get install -y python3 python3-pip + + +# SDKs +RUN cd /tmp && curl -sL https://aka.ms/InstallAzureCLIDeb | bash +RUN cd /tmp && curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ + unzip awscliv2.zip && ./aws/install + + +# Scripts +RUN git clone --depth=1 https://github.com/game-ci/unity-builder.git /gameci && \ + cp -rf /gameci/dist/platforms/ubuntu/steps /steps && \ + cp -rf /gameci/dist/default-build-script /UnityBuilderAction && \ + cp /gameci/dist/platforms/ubuntu/entrypoint.sh /entrypoint.sh + COPY scripts/build.sh /build.sh RUN chmod +x /build.sh @@ -86,5 +98,5 @@ LABEL com.unity3d.modules="$MODULE" LABEL org.blender.version="$BLENDER_FULL_VERSION" # Done -ENTRYPOINT [ "/entrypoint.sh" ] -# ENTRYPOINT [ "/bin/bash" ]~ \ No newline at end of file +# ENTRYPOINT [ "/entrypoint.sh" ] +ENTRYPOINT [ "/bin/bash" ] \ No newline at end of file diff --git a/make-local-container.sh b/make-local-container.sh new file mode 100644 index 0000000..e621456 --- /dev/null +++ b/make-local-container.sh @@ -0,0 +1,4 @@ +UNITY_VERSION=6000.0.35f1 \ +UNITY_MODULES="webgl android ios mac-mono windows-mono linux-il2cpp" \ +IMAGE=docker.lakes.house/unityci/editor \ +.gitea/workflows/scripts/build-runner-image.sh \ No newline at end of file diff --git a/scripts/install-module.sh b/scripts/install-module.sh new file mode 100644 index 0000000..82acebf --- /dev/null +++ b/scripts/install-module.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +VERSION="$1" +ENABLED_MODULES="$2" +MODULE_TO_INSTALL="$3" +CHILDLESS="$4" + +# Check if MODULE_TO_INSTALL is in ENABLED_MODULES +if [[ " $ENABLED_MODULES " =~ " $MODULE_TO_INSTALL " ]]; then + CMD="unity-hub install-modules --version \"$VERSION\" --module \"$MODULE_TO_INSTALL\"" + if [[ "$CHILDLESS" != "childless" ]]; then + CMD="$CMD --childModules" + fi + echo "Running: $CMD" + $CMD +else + echo "Module '$MODULE_TO_INSTALL' is not enabled. Skipping installation." +fi