forked from Conjure-Tools/unity-runner
Updated build scripts
This commit is contained in:
parent
9773ac7510
commit
046c8e195b
@ -1,9 +1,9 @@
|
|||||||
name: Create Images
|
name: 🤓 Individual Runners
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
branches: [main]
|
# branches: [main]
|
||||||
paths: ['versions.txt']
|
# paths: ['versions.txt']
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
50
.gitea/workflows/create-runner.yaml
Normal file
50
.gitea/workflows/create-runner.yaml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
name: 😎 Uber Runner
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- versions.txt
|
||||||
|
- dockerfiles/runner.dockerfile
|
||||||
|
- .github/workflows/create-runner.yaml
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOCKER_REGISTRY: docker.lakes.house/
|
||||||
|
UNITY_MODULES: webgl android ios mac-mono windows-mono linux-il2cpp
|
||||||
|
GAMECI_VERSION: 3
|
||||||
|
|
||||||
|
name: Build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Login to Docker Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.DOCKER_REGISTRY }}
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Get Unity Version
|
||||||
|
run: |
|
||||||
|
VERSION=$(head -n 1 versions.txt)
|
||||||
|
echo "UNITY_VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
echo "Unity Version: $VERSION"
|
||||||
|
|
||||||
|
- name: Docker Build
|
||||||
|
run: .gitea/workflows/scripts/build-runner-image.sh
|
||||||
|
id: build-image
|
||||||
|
env:
|
||||||
|
UNITY_VERSION: ${{ env.UNITY_VERSION }}
|
||||||
|
UNITY_MODULES: ${{ env.UNITY_MODULES }}
|
||||||
|
GAMECI_VERSION: ${{ env.GAMECI_VERSION }}
|
||||||
|
GAMECI_OS: ubuntu
|
||||||
|
IMAGE: ${{ env.DOCKER_REGISTRY }}unityci/editor
|
||||||
|
|
||||||
|
- name: Docker Push
|
||||||
|
run: |
|
||||||
|
echo "Pushing Docker Image ${{ steps.build-image.outputs.FULL_IMAGE }}"
|
||||||
|
echo "- Image: ${{ steps.build-image.outputs.IMAGE }}"
|
||||||
|
echo "- Tag: ${{ steps.build-image.outputs.TAG }}"
|
||||||
|
docker push ${{ steps.build-image.outputs.FULL_IMAGE }}
|
||||||
3
.gitea/workflows/scripts/build-image.sh → .gitea/workflows/scripts/build-individual-image.sh
Executable file → Normal file
3
.gitea/workflows/scripts/build-image.sh → .gitea/workflows/scripts/build-individual-image.sh
Executable file → Normal file
@ -85,8 +85,7 @@ docker build \
|
|||||||
--build-arg BASE_IMAGE=${BASE_IMAGE} \
|
--build-arg BASE_IMAGE=${BASE_IMAGE} \
|
||||||
${ADDITIONAL_TAGS} \
|
${ADDITIONAL_TAGS} \
|
||||||
-t ${FULL_IMAGE} \
|
-t ${FULL_IMAGE} \
|
||||||
${DOCKER_BUILD_ARGS} \
|
${DOCKER_BUILD_ARGS} dockerfiles/individual.dockerfile
|
||||||
.
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error: Docker build failed."
|
echo "Error: Docker build failed."
|
||||||
@ -10,13 +10,16 @@ if [ -z "${UNITY_VERSION}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Fetch the changelog and extract the changeset ID for the specified Unity version
|
# Fetch the changelog and extract the changeset ID for the specified Unity version
|
||||||
CHANGELOG_URL="https://public-cdn.cloud.unity3d.com/hub/prod/releases-${UNITY_VERSION}.json"
|
# This is because hub doesnt remember every version of unity and uses the changset for the exact id lookup.
|
||||||
CHANGESET_ID=$(curl -s "$CHANGELOG_URL" | grep -o '"changeset":[^,]*' | head -n 1 | cut -d':' -f2 | tr -d ' "')
|
if [ -z "${UNITY_CHANGESET}" ]; then
|
||||||
|
echo "Warning: No changeset provided. Scraping one from the change logs."
|
||||||
if [ -z "$CHANGESET_ID" ]; then
|
echo "This might take a while. Use the UNITY_CHANGESET to avoid this lookup."
|
||||||
echo "Warning: Could not retrieve changeset ID for Unity version ${UNITY_VERSION}."
|
CHANGELOG_URL="https://unity.com/releases/editor/whats-new/${UNITY_VERSION}"
|
||||||
else
|
UNITY_CHANGESET=$(curl -s -r 0-500 "$CHANGELOG_URL" | grep -oP 'unityhub://(?:[0-9a-z.])+/\K([a-z0-9]+)' | head -n 1)
|
||||||
echo "Unity ${UNITY_VERSION} changeset ID: ${CHANGESET_ID}"
|
if [ -z "$UNITY_CHANGESET" ]; then
|
||||||
|
echo "Error: Could not extract changeset for Unity version ${UNITY_VERSION}."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure we have some modules
|
# Ensure we have some modules
|
||||||
@ -82,6 +85,8 @@ DEST_TAG=${GAMECI_OS}-${UNITY_VERSION}-runner
|
|||||||
DEST_IMAGE=${IMAGE}:${DEST_TAG}
|
DEST_IMAGE=${IMAGE}:${DEST_TAG}
|
||||||
|
|
||||||
echo "Building Docker image ${DEST_IMAGE}"
|
echo "Building Docker image ${DEST_IMAGE}"
|
||||||
|
echo "- Version: ${UNITY_VERSION}"
|
||||||
|
echo "- Changeset: ${UNITY_CHANGESET}"
|
||||||
echo "- Platfrom: ${PLATFORM}"
|
echo "- Platfrom: ${PLATFORM}"
|
||||||
echo "- Base: ${BASE_IMAGE}"
|
echo "- Base: ${BASE_IMAGE}"
|
||||||
echo "- Tag: ${DEST_TAG}"
|
echo "- Tag: ${DEST_TAG}"
|
||||||
@ -90,11 +95,10 @@ echo "- Image: ${DEST_IMAGE}"
|
|||||||
docker build \
|
docker build \
|
||||||
--platform ${PLATFORM} \
|
--platform ${PLATFORM} \
|
||||||
--build-arg "VERSION=${UNITY_VERSION}" \
|
--build-arg "VERSION=${UNITY_VERSION}" \
|
||||||
|
--build-arg "CHANGESET=${UNITY_CHANGESET}" \
|
||||||
--build-arg "BASE_IMAGE=${BASE_IMAGE}" \
|
--build-arg "BASE_IMAGE=${BASE_IMAGE}" \
|
||||||
--build-arg "MODULE=${UNITY_MODULES}" \
|
--build-arg "MODULE=${UNITY_MODULES}" \
|
||||||
-t ${DEST_IMAGE} \
|
-t ${DEST_IMAGE} ${DOCKER_BUILD_ARGS} dockerfiles/runner.dockerfile
|
||||||
${DOCKER_BUILD_ARGS} \
|
|
||||||
.
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error: Docker build failed."
|
echo "Error: Docker build failed."
|
||||||
|
|||||||
4
.github/workflows/create-image.yaml
vendored
4
.github/workflows/create-image.yaml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Create Images
|
name: Individual Runners
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@ -43,7 +43,7 @@ jobs:
|
|||||||
echo "Unity Version: $VERSION"
|
echo "Unity Version: $VERSION"
|
||||||
|
|
||||||
- name: Docker Build
|
- name: Docker Build
|
||||||
run: .gitea/workflows/scripts/build-image.sh
|
run: .gitea/workflows/scripts/build-individual-image.sh
|
||||||
id: build-image
|
id: build-image
|
||||||
env:
|
env:
|
||||||
UNITY_VERSION: ${{ env.UNITY_VERSION }}
|
UNITY_VERSION: ${{ env.UNITY_VERSION }}
|
||||||
|
|||||||
52
.github/workflows/create-runner.yaml
vendored
Normal file
52
.github/workflows/create-runner.yaml
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
name: 😎 Uber Runner
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- versions.txt
|
||||||
|
- dockerfiles/runner.dockerfile
|
||||||
|
- .github/workflows/create-runner.yaml
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
UNITY_MODULES: webgl android ios mac-mono windows-mono linux-il2cpp
|
||||||
|
|
||||||
|
environment:
|
||||||
|
name: Docker Hub
|
||||||
|
|
||||||
|
name: Build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Get Unity Version
|
||||||
|
id: unity-version
|
||||||
|
run: |
|
||||||
|
VERSION=$(head -n 1 versions.txt)
|
||||||
|
echo "UNITY_VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
echo "Unity Version: $VERSION"
|
||||||
|
|
||||||
|
- name: Docker Build
|
||||||
|
run: .gitea/workflows/scripts/build-runner-image.sh
|
||||||
|
id: build-image
|
||||||
|
env:
|
||||||
|
UNITY_VERSION: ${{ env.UNITY_VERSION }}
|
||||||
|
UNITY_MODULES: ${{ env.UNITY_MODULES }}
|
||||||
|
GAMECI_VERSION: ${{ env.GAMECI_VERSION }}
|
||||||
|
GAMECI_OS: ubuntu
|
||||||
|
IMAGE: "${{ vars.DOCKERHUB_USERNAME }}/unity-runner"
|
||||||
|
|
||||||
|
- name: Docker Push
|
||||||
|
run: |
|
||||||
|
echo "Pushing Docker Image ${{ steps.build-image.outputs.FULL_IMAGE }}"
|
||||||
|
echo "- Image: ${{ steps.build-image.outputs.IMAGE }}"
|
||||||
|
echo "- Tag: ${{ steps.build-image.outputs.TAG }}"
|
||||||
|
docker push ${{ steps.build-image.outputs.FULL_IMAGE }}
|
||||||
41
dockerfiles/individual.dockerfile
Normal file
41
dockerfiles/individual.dockerfile
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
ARG BASE_IMAGE=unityci/editor
|
||||||
|
|
||||||
|
FROM $BASE_IMAGE
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
gcc \
|
||||||
|
make \
|
||||||
|
libssl-dev \
|
||||||
|
zlib1g-dev \
|
||||||
|
libsqlite3-dev
|
||||||
|
|
||||||
|
# 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" && \
|
||||||
|
echo echo "BLENDER_SHORT_VERSION: $BLENDER_SHORT_VERSION" && \
|
||||||
|
apt-get install -y wget && \
|
||||||
|
wget https://download.blender.org/release/Blender$BLENDER_SHORT_VERSION/blender-$BLENDER_FULL_VERSION-linux-x64.tar.xz && \
|
||||||
|
tar -xf blender-$BLENDER_FULL_VERSION-linux-x64.tar.xz && \
|
||||||
|
rm blender-$BLENDER_FULL_VERSION-linux-x64.tar.xz
|
||||||
|
ENV PATH="$PATH:/blender-$BLENDER_FULL_VERSION-linux-x64"
|
||||||
|
|
||||||
|
# Add custom scripts
|
||||||
|
COPY scripts/build.sh /build.sh
|
||||||
|
RUN chmod +x /build.sh
|
||||||
|
|
||||||
|
# Done
|
||||||
|
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||||
@ -7,10 +7,9 @@ ARG HUB_IMAGE="unityci/hub"
|
|||||||
FROM $HUB_IMAGE AS builder
|
FROM $HUB_IMAGE AS builder
|
||||||
# Install editor
|
# Install editor
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
ARG CHANGE_SET
|
ARG CHANGESET
|
||||||
RUN unity-hub install --version "$VERSION" --changeset "$CHANGE_SET" | \
|
RUN unity-hub install --version "$VERSION" --changeset "$CHANGESET" \
|
||||||
tee /var/log/install-editor.log && grep 'Failed to install\|Error while installing an editor\|Completed with errors' /var/log/install-editor.log | \
|
| tee /var/log/install-editor.log && grep 'Failed to install\|Error while installing an editor\|Completed with errors' /var/log/install-editor.log | exit $(wc -l)
|
||||||
exit $(wc -l)
|
|
||||||
|
|
||||||
# Install modules for that editor
|
# Install modules for that editor
|
||||||
ARG MODULE="non-existent-module"
|
ARG MODULE="non-existent-module"
|
||||||
@ -35,12 +34,17 @@ RUN echo "$VERSION-$MODULE" | grep -q -vP '^(2021.2.(?)|2021.[3-9
|
|||||||
|| unity-hub install-modules --version "$VERSION" --module "windows-server" --childModules | \
|
|| 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);
|
tee /var/log/install-module-windows-server.log && grep 'Missing module' /var/log/install-module-windows-server.log | exit $(wc -l);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Editor #
|
# Editor #
|
||||||
###########################
|
###########################
|
||||||
FROM $BASE_IMAGE
|
FROM $BASE_IMAGE
|
||||||
|
|
||||||
|
# Always put "Editor" and "modules.json" directly in $UNITY_PATH
|
||||||
|
ARG VERSION
|
||||||
|
ARG MODULE
|
||||||
|
COPY --from=builder /opt/unity/editors/$VERSION/ "$UNITY_PATH/"
|
||||||
|
RUN echo $VERSION > "$UNITY_PATH/version"
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
git \
|
git \
|
||||||
@ -78,4 +82,4 @@ COPY scripts/build.sh /build.sh
|
|||||||
RUN chmod +x /build.sh
|
RUN chmod +x /build.sh
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
# ENTRYPOINT [ "/bin/bash" ]
|
||||||
Loading…
x
Reference in New Issue
Block a user