├── .dockerignore ├── .editorconfig ├── .env ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── other.md ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── build-all.yml │ ├── build-editor.yml │ ├── release.yml │ └── request-activation-lisence-file.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build.sh ├── config └── asound.conf ├── dockerfiles ├── base.Dockerfile ├── editor.Dockerfile ├── editor_module.Dockerfile └── hub.Dockerfile ├── media └── Discord-Logo.svg ├── package-lock.json └── package.json /.dockerignore: -------------------------------------------------------------------------------- 1 | /reference-project/ 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root=true 2 | 3 | [*] 4 | charset=utf-8 5 | indent_style=space 6 | indent_size=2 7 | insert_final_newline=true 8 | trim_trailing_whitespace=true 9 | end_of_line=lf 10 | 11 | [*.md] 12 | trim_trailing_whitespace=false 13 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # Docker Hub: docker.io 2 | # GitHub Container Registory: ghcr.io 3 | DOCKER_REGISTRY=ghcr.io 4 | DOCKER_USERNAME=mob-sakai 5 | 6 | # Full image ID 7 | BASE_IMAGE=ghcr.io/mob-sakai/unity_base 8 | HUB_IMAGE=ghcr.io/mob-sakai/unity_hub 9 | EDITOR_IMAGE=ghcr.io/mob-sakai/unity3d 10 | 11 | # Minimum Unity version 12 | MINIMUM_UNITY_VERSION=2018.3 13 | 14 | # Ignored Unity versions (Regular expressions) 15 | IGNORED_UNITY_VERSIONS=" 16 | ^2020.2.0a 17 | " 18 | 19 | # Ignored image tags (Regular expressions) 20 | IGNORED_IMAGE_TAGS=" 21 | ^2018.*linux-il2cpp 22 | ^2019.1.*linux-il2cpp 23 | ^2019.2.*linux-il2cpp 24 | " 25 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | # Unity files 4 | *.asset linguist-generated -text -merge=unityamlmerge 5 | *.mat linguist-generated -text -merge=unityamlmerge 6 | *.meta linguist-generated -text -merge=unityamlmerge 7 | *.prefab linguist-generated -text -merge=unityamlmerge 8 | *.unity linguist-generated -text -merge=unityamlmerge 9 | 10 | # Image formats 11 | *.psd filter=lfs diff=lfs merge=lfs -text 12 | *.afphoto filter=lfs diff=lfs merge=lfs -text 13 | *.jpg filter=lfs diff=lfs merge=lfs -text 14 | *.png filter=lfs diff=lfs merge=lfs -text 15 | *.gif filter=lfs diff=lfs merge=lfs -text 16 | *.bmp filter=lfs diff=lfs merge=lfs -text 17 | *.tga filter=lfs diff=lfs merge=lfs -text 18 | *.tiff filter=lfs diff=lfs merge=lfs -text 19 | *.iff filter=lfs diff=lfs merge=lfs -text 20 | *.pict filter=lfs diff=lfs merge=lfs -text 21 | *.dds filter=lfs diff=lfs merge=lfs -text 22 | 23 | # Audio formats 24 | *.mp3 filter=lfs diff=lfs merge=lfs -text 25 | *.ogg filter=lfs diff=lfs merge=lfs -text 26 | *.wav filter=lfs diff=lfs merge=lfs -text 27 | *.aiff filter=lfs diff=lfs merge=lfs -text 28 | *.aif filter=lfs diff=lfs merge=lfs -text 29 | *.mod filter=lfs diff=lfs merge=lfs -text 30 | *.it filter=lfs diff=lfs merge=lfs -text 31 | *.s3m filter=lfs diff=lfs merge=lfs -text 32 | *.xm filter=lfs diff=lfs merge=lfs -text 33 | 34 | # Video formats 35 | *.mov filter=lfs diff=lfs merge=lfs -text 36 | *.avi filter=lfs diff=lfs merge=lfs -text 37 | *.asf filter=lfs diff=lfs merge=lfs -text 38 | *.mpg filter=lfs diff=lfs merge=lfs -text 39 | *.mpeg filter=lfs diff=lfs merge=lfs -text 40 | *.mp4 filter=lfs diff=lfs merge=lfs -text 41 | 42 | # 3D formats 43 | *.fbx filter=lfs diff=lfs merge=lfs -text 44 | *.obj filter=lfs diff=lfs merge=lfs -text 45 | *.max filter=lfs diff=lfs merge=lfs -text 46 | *.blend filter=lfs diff=lfs merge=lfs -text 47 | *.dae filter=lfs diff=lfs merge=lfs -text 48 | *.mb filter=lfs diff=lfs merge=lfs -text 49 | *.ma filter=lfs diff=lfs merge=lfs -text 50 | *.3ds filter=lfs diff=lfs merge=lfs -text 51 | *.dfx filter=lfs diff=lfs merge=lfs -text 52 | *.c4d filter=lfs diff=lfs merge=lfs -text 53 | *.lwo filter=lfs diff=lfs merge=lfs -text 54 | *.lwo2 filter=lfs diff=lfs merge=lfs -text 55 | *.abc filter=lfs diff=lfs merge=lfs -text 56 | *.3dm filter=lfs diff=lfs merge=lfs -text 57 | 58 | # Build 59 | *.dll filter=lfs diff=lfs merge=lfs -text 60 | *.pdb filter=lfs diff=lfs merge=lfs -text 61 | *.mdb filter=lfs diff=lfs merge=lfs -text 62 | 63 | # Packaging 64 | *.zip filter=lfs diff=lfs merge=lfs -text 65 | *.7z filter=lfs diff=lfs merge=lfs -text 66 | *.gz filter=lfs diff=lfs merge=lfs -text 67 | *.rar filter=lfs diff=lfs merge=lfs -text 68 | *.tar filter=lfs diff=lfs merge=lfs -text 69 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | --- 8 | 9 | **Bug description** 10 | 11 | 12 | 13 | 14 | **How to reproduce** 15 | 16 | 17 | 18 | 19 | **Expected behavior** 20 | 21 | 22 | 23 | 24 | **Additional details** 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an improvement or now feature 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Context** 10 | 11 | 12 | 13 | 14 | **Suggested solution** 15 | 16 | 17 | 18 | 19 | **Considered alternatives** 20 | 21 | 22 | 23 | 24 | **Additional details** 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: Anything else 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Description** 10 | 11 | 12 | 13 | 14 | **Context** 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | #### Changes 2 | 3 | - ... 4 | 5 | #### Checklist 6 | 7 | 8 | 9 | - [x] Read the contribution [guide](../CONTRIBUTING.md) and accept the [code](../CODE_OF_CONDUCT.md) of conduct 10 | - [ ] Readme (updated or not needed) 11 | -------------------------------------------------------------------------------- /.github/workflows/build-all.yml: -------------------------------------------------------------------------------- 1 | name: Build All 2 | 3 | on: 4 | workflow_dispatch: 5 | create: 6 | tags: 7 | - "v*" 8 | 9 | jobs: 10 | build: 11 | name: "Build all" 12 | runs-on: ubuntu-18.04 13 | steps: 14 | ########################### 15 | # Setup env # 16 | ########################### 17 | - uses: actions/checkout@v2 18 | - run: cat .env | sed 's/=\" *$/<> $GITHUB_ENV 19 | 20 | - name: Get latest tag 21 | id: latest 22 | run: | 23 | LATEST_TAG=`git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='v:refname' --tags https://github.com/${{ github.repository }} 'v*.*' \ 24 | | tail -n 1 \ 25 | | cut -d '/' -f 3` 26 | echo $LATEST_TAG 27 | echo "::set-output name=tag::$LATEST_TAG" 28 | - uses: actions/checkout@v2 29 | with: 30 | ref: ${{ steps.latest.outputs.tag }} 31 | 32 | ########################### 33 | # Setup # 34 | ########################### 35 | - name: Set up QEMU 36 | uses: docker/setup-qemu-action@v1 37 | - name: Set up Docker Buildx 38 | uses: docker/setup-buildx-action@v1 39 | with: 40 | buildkitd-flags: --debug 41 | - name: Login to docker registry 42 | uses: docker/login-action@v1 43 | with: 44 | registry: ${{ env.DOCKER_REGISTRY }} 45 | username: ${{ env.DOCKER_USERNAME }} 46 | password: ${{ secrets.DOCKER_TOKEN }} 47 | - name: Cache Docker layers 48 | uses: actions/cache@v2 49 | with: 50 | path: /tmp/.buildx-cache 51 | key: ${{ runner.os }}-${{ steps.latest.outputs.tag }} 52 | restore-keys: ${{ runner.os }}- 53 | 54 | ########################### 55 | # Build and push (Base) # 56 | ########################### 57 | - uses: crazy-max/ghaction-docker-meta@v1 58 | id: base_docker 59 | with: 60 | images: ${{ env.BASE_IMAGE }} 61 | - name: Build (Base) 62 | uses: docker/build-push-action@v2 63 | with: 64 | context: . 65 | file: dockerfiles/base.Dockerfile 66 | cache-from: type=local,src=/tmp/.buildx-cache 67 | cache-to: type=local,dest=/tmp/.buildx-cache 68 | push: true 69 | labels: ${{ steps.base_docker.outputs.labels }} 70 | tags: ${{ steps.base_docker.outputs.tags }} 71 | 72 | ########################### 73 | # Build and push (Hub) # 74 | ########################### 75 | - uses: crazy-max/ghaction-docker-meta@v1 76 | id: hub_docker 77 | with: 78 | images: ${{ env.HUB_IMAGE }} 79 | - name: Build (Hub) 80 | uses: docker/build-push-action@v2 81 | with: 82 | context: . 83 | file: dockerfiles/hub.Dockerfile 84 | build-args: baseImage=${{ env.BASE_IMAGE }}:${{ steps.latest.outputs.tag }} 85 | cache-from: type=local,src=/tmp/.buildx-cache 86 | cache-to: type=local,dest=/tmp/.buildx-cache 87 | push: true 88 | labels: ${{ steps.hub_docker.outputs.labels }} 89 | tags: ${{ steps.hub_docker.outputs.tags }} 90 | 91 | ########################### 92 | # Build base editor image # 93 | ########################### 94 | - name: "Dispatch 'Build Editor' workflow" 95 | uses: benc-uk/workflow-dispatch@v1 96 | with: 97 | workflow: Build Editor 98 | token: ${{ secrets.GH_WORKFLOW_TOKEN }} 99 | inputs: '{ "module": "base", "repoTag": "${{ steps.latest.outputs.tag }}" }' 100 | ref: ${{ steps.latest.outputs.tag }} 101 | -------------------------------------------------------------------------------- /.github/workflows/build-editor.yml: -------------------------------------------------------------------------------- 1 | name: Build Editor 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | module: 7 | description: "Unity module to build.\n(base|linux-il2cpp|windows-mono|mac-mono|ios|android|webgl)" 8 | required: true 9 | default: "base" 10 | repoTag: 11 | description: "" 12 | required: true 13 | 14 | jobs: 15 | setup: 16 | name: Setup build matrix (${{ github.event.inputs.module }}) 17 | runs-on: ubuntu-18.04 18 | outputs: 19 | matrix: ${{ steps.setup.outputs.matrix }} 20 | existTags: ${{ steps.setup.outputs.existTags }} 21 | exit: ${{ steps.setup.outputs.exit }} 22 | steps: 23 | ########################### 24 | # Setup env # 25 | ########################### 26 | - uses: actions/checkout@v2 27 | - run: cat .env | sed 's/=\" *$/<> $GITHUB_ENV 28 | 29 | ########################### 30 | # Setup build matrix # 31 | ########################### 32 | - name: Login to docker registry 33 | uses: docker/login-action@v1 34 | with: 35 | registry: ${{ env.DOCKER_REGISTRY }} 36 | username: ${{ env.DOCKER_USERNAME }} 37 | password: ${{ secrets.DOCKER_TOKEN }} 38 | - name: Setup build matrix 39 | id: setup 40 | run: | 41 | echo "Module: ${{ github.event.inputs.module }}" 42 | echo "docker: $EDITOR_IMAGE:*-${{ github.event.inputs.repoTag }}" 43 | 44 | echo '' > EXIST_TAGS 45 | skopeo list-tags docker://$EDITOR_IMAGE \ 46 | | jq -r '.Tags[]' \ 47 | | grep -e "-${{ github.event.inputs.repoTag }}$" > EXIST_TAGS || : 48 | 49 | echo '' > .ignoreversions 50 | if [ "${{ github.event.inputs.module }}" == 'base' ] ; then 51 | echo -n "$IGNORED_UNITY_VERSIONS" | grep '.' > .ignoreversions 52 | VERSIONS=`npx unity-changeset list --versions --min $MINIMUM_UNITY_VERSION --all \ 53 | | grep -v -f .ignoreversions || :` 54 | else 55 | VERSIONS=`cat EXIST_TAGS \ 56 | | grep -e "-base-${{ github.event.inputs.repoTag }}$" \ 57 | | cut -d '-' -f 1 || :` 58 | fi 59 | 60 | VERSIONS=`for version in $(echo "$VERSIONS") ; do \ 61 | [ ! $(grep -x "${version}-${{ github.event.inputs.module }}-${{ github.event.inputs.repoTag }}" EXIST_TAGS) ] && echo "$version" || : ; \ 62 | done` 63 | 64 | VERSIONS=`echo "$VERSIONS" | paste -s -d ',' - | sed 's/,/\", \"/g' || :` 65 | [ "$VERSIONS" = '' ] && echo "::warning::No versions to build.%0A[Ignore versions]%0A`cat .ignoreversions`" && echo "::set-output name=exit::true" && exit 0 66 | 67 | matrix="{ \ 68 | \"version\":[\"$VERSIONS\"], \ 69 | \"module\":[\"${{ github.event.inputs.module }}\"] \ 70 | }" 71 | echo "$matrix" 72 | echo "::set-output name=matrix::$matrix" 73 | echo "::set-output name=existTags::`cat EXIST_TAGS`" 74 | echo "::set-output name=exit::false" 75 | 76 | build: 77 | name: Build ${{ matrix.version }} ${{ matrix.module }} 78 | if: needs.setup.outputs.exit != 'true' 79 | needs: setup 80 | runs-on: ubuntu-18.04 81 | strategy: 82 | fail-fast: false 83 | matrix: ${{ fromJson(needs.setup.outputs.matrix) }} 84 | # The matrix is expanded like this: 85 | # matrix: 86 | # version: 87 | # - 2018.3.1f1 88 | # ... 89 | # module: 90 | # - base 91 | steps: 92 | ########################### 93 | # Setup env # 94 | ########################### 95 | - uses: actions/checkout@v2 96 | - run: cat .env | sed 's/=\" *$/<> $GITHUB_ENV 97 | - uses: actions/checkout@v2 98 | with: 99 | ref: ${{ github.event.inputs.repoTag }} 100 | 101 | ########################### 102 | # Check # 103 | ########################### 104 | - name: Check to build 105 | id: check 106 | run: | 107 | # [SKIP] Tag is ignored to build. 108 | echo -n "$IGNORED_IMAGE_TAGS" > .ignoretags 109 | TAG=${{ matrix.version }}-${{ matrix.module }}-${{ github.event.inputs.repoTag }} 110 | if [ -n "`echo $TAG | grep -f .ignoretags`" ] ; then 111 | echo "::warning::[SKIP] Tag $TAG is ignored to build. Build steps will be skipped.%0A[Ignore tags]%0A`cat .ignoretags`" 112 | 113 | # [SKIP] Image already exists. 114 | elif [ `echo "${{ needs.setup.outputs.existTags }}" | cat - | grep -x "$TAG"` ] ; then 115 | echo "::warning::[SKIP] Image $EDITOR_IMAGE:$TAG already exists. Build steps will be skipped." 116 | 117 | # Ready to build. 118 | else 119 | CHANGESET=`npx unity-changeset ${{ matrix.version }}` 120 | echo "Image $EDITOR_IMAGE:${TAG} does not exist. Build image.%0A[Change Set] $CHANGESET" 121 | echo "::set-output name=changeset::$CHANGESET" 122 | if [ "${{ matrix.module }}" = 'base' ] ; then 123 | echo "::set-output name=dockerFile::dockerfiles/editor.Dockerfile" 124 | echo "::set-output name=dockerTag::${{ matrix.version }}" 125 | else 126 | echo "::set-output name=dockerFile::dockerfiles/editor_module.Dockerfile" 127 | echo "::set-output name=dockerTag::$TAG" 128 | fi 129 | fi 130 | 131 | ########################### 132 | # Setup # 133 | ########################### 134 | - name: Set up QEMU 135 | if: steps.check.outputs.changeset != '' 136 | uses: docker/setup-qemu-action@v1 137 | - name: Set up Docker Buildx 138 | if: steps.check.outputs.changeset != '' 139 | uses: docker/setup-buildx-action@v1 140 | with: 141 | buildkitd-flags: --debug 142 | - name: Login to docker registry 143 | if: steps.check.outputs.changeset != '' 144 | uses: docker/login-action@v1 145 | with: 146 | registry: ${{ env.DOCKER_REGISTRY }} 147 | username: ${{ env.DOCKER_USERNAME }} 148 | password: ${{ secrets.DOCKER_TOKEN }} 149 | # Cache limitation: 5GB per repo, and 7days. 150 | # Do not cache each version because it is too small to install Unity. 151 | - name: Cache Docker layers 152 | if: steps.check.outputs.changeset != '' 153 | uses: actions/cache@v2 154 | with: 155 | path: /tmp/.buildx-cache 156 | key: ${{ runner.os }}-${{ github.event.inputs.repoTag }} 157 | restore-keys: ${{ runner.os }}- 158 | 159 | ########################### 160 | # Free disk space # 161 | ########################### 162 | - name: Free disk space 163 | if: steps.check.outputs.changeset != '' 164 | run: | 165 | # Based on: 166 | # https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh 167 | # https://github.com/actions/virtual-environments/issues/709#issuecomment-612569242 168 | echo "==== Disk space before:" 169 | df -h 170 | 171 | echo "==== Removing large directories..." 172 | rm -rf /usr/share/dotnet/ 173 | rm -rf /usr/local/share/boost 174 | rm -rf "$AGENT_TOOLSDIRECTORY" 175 | 176 | echo "==== Disk space after:" 177 | df -h 178 | 179 | ########################### 180 | # Editor image # 181 | ########################### 182 | - uses: crazy-max/ghaction-docker-meta@v1 183 | id: docker 184 | with: 185 | images: ${{ env.EDITOR_IMAGE }} 186 | tag-custom-only: true 187 | tag-custom: | 188 | ${{ matrix.version }}-${{ matrix.module }}-${{ github.event.inputs.repoTag }} 189 | ${{ matrix.version }}-${{ matrix.module }} 190 | 191 | - name: Build 192 | if: steps.check.outputs.changeset != '' 193 | uses: docker/build-push-action@v2 194 | timeout-minutes: 60 195 | with: 196 | context: . 197 | file: ${{ steps.check.outputs.dockerFile }} 198 | build-args: | 199 | hubImage=${{ env.HUB_IMAGE }}:${{ github.event.inputs.repoTag }} 200 | baseImage=${{ env.BASE_IMAGE }}:${{ github.event.inputs.repoTag }} 201 | editorBaseImage=${{ env.EDITOR_IMAGE }}:${{ matrix.version }} 202 | version=${{ matrix.version }} 203 | changeSet=${{ steps.check.outputs.changeset }} 204 | module=${{ matrix.module }} 205 | cache-from: type=local,src=/tmp/.buildx-cache 206 | load: true 207 | labels: ${{ steps.docker.outputs.labels }} 208 | tags: | 209 | ${{ steps.docker.outputs.tags }} 210 | ${{ env.EDITOR_IMAGE }}:${{ steps.check.outputs.dockerTag }} 211 | 212 | - name: Push 213 | if: steps.check.outputs.changeset != '' 214 | run: | 215 | # Sometimes the image push fails. 216 | # >> failed commit on ref "layer-sha256:...": no response 217 | # See https://github.com/docker/build-push-action/blob/master/TROUBLESHOOTING.md 218 | docker push ${{ env.EDITOR_IMAGE }} \ 219 | || docker push ${{ env.EDITOR_IMAGE }} \ 220 | || docker push ${{ env.EDITOR_IMAGE }} 221 | # 222 | request-alf: 223 | name: Request Activation License File 224 | needs: [setup, build] 225 | if: always() && needs.setup.outputs.exit != 'true' && github.event.inputs.module == 'base' 226 | runs-on: ubuntu-18.04 227 | steps: 228 | - name: "Dispatch 'Request Activation License File' workflow" 229 | uses: benc-uk/workflow-dispatch@v1 230 | with: 231 | workflow: Request Activation License File 232 | token: ${{ secrets.GH_WORKFLOW_TOKEN }} 233 | inputs: '{ "repoTag": "${{ github.event.inputs.repoTag }}" }' 234 | 235 | # 236 | build-modules: 237 | name: Build Editor 238 | needs: [setup, build, request-alf] 239 | if: always() && needs.setup.outputs.exit != 'true' && github.event.inputs.module == 'base' 240 | runs-on: ubuntu-18.04 241 | strategy: 242 | matrix: 243 | module: [linux-il2cpp, windows-mono, mac-mono, ios, android, webgl] 244 | steps: 245 | - run: sleep 60 246 | - name: Build Editor ${{ matrix.module }} 247 | uses: benc-uk/workflow-dispatch@v1 248 | with: 249 | workflow: Build Editor 250 | token: ${{ secrets.GH_WORKFLOW_TOKEN }} 251 | inputs: '{ "module": "${{ matrix.module }}", "repoTag": "${{ github.event.inputs.repoTag }}" }' 252 | ref: ${{ github.event.inputs.repoTag }} 253 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | branches: 6 | - beta 7 | - main 8 | - v*.x 9 | tags-ignore: 10 | - "**" 11 | 12 | jobs: 13 | release: 14 | runs-on: ubuntu-latest 15 | if: "! contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.head_commit.message, '[ci skip]')" 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - uses: actions/cache@v2 20 | with: 21 | path: ~/.npm 22 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 23 | restore-keys: | 24 | ${{ runner.os }}-node- 25 | 26 | - name: Release 27 | id: release 28 | run: | 29 | npm ci 30 | npx semantic-release 31 | 32 | echo "::set-output name=tag::`git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='v:refname' --tags https://github.com/${{ github.repository }} 'v*.*' \ 33 | | tail -n 1 \ 34 | | cut -d '/' -f 3`" 35 | env: 36 | GITHUB_TOKEN: ${{ github.token }} 37 | 38 | - name: "Dispatch 'Build All' workflow" 39 | uses: benc-uk/workflow-dispatch@v1 40 | with: 41 | workflow: Build All 42 | token: ${{ secrets.GH_WORKFLOW_TOKEN }} 43 | ref: ${{ steps.release.outputs.tag }} 44 | -------------------------------------------------------------------------------- /.github/workflows/request-activation-lisence-file.yml: -------------------------------------------------------------------------------- 1 | name: "Request Activation License File" 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | repoTag: 7 | description: "" 8 | required: true 9 | 10 | jobs: 11 | setup: 12 | name: Setup build matrix 13 | runs-on: ubuntu-18.04 14 | outputs: 15 | matrix: ${{ steps.setup.outputs.matrix }} 16 | exit: ${{ steps.setup.outputs.exit }} 17 | steps: 18 | ########################### 19 | # Setup env # 20 | ########################### 21 | - uses: actions/checkout@v2 22 | - run: cat .env | sed 's/=\" *$/<> $GITHUB_ENV 23 | 24 | ########################### 25 | # Setup build matrix # 26 | ########################### 27 | - name: Login to docker registry 28 | uses: docker/login-action@v1 29 | with: 30 | registry: ${{ env.DOCKER_REGISTRY }} 31 | username: ${{ env.DOCKER_USERNAME }} 32 | password: ${{ secrets.DOCKER_TOKEN }} 33 | - name: Setup build matrix 34 | id: setup 35 | run: | 36 | # Show inputs 37 | echo "inputs: ${{ toJson(github.event.inputs) }}" 38 | 39 | REPO_TAG=${{ github.event.inputs.repoTag }} 40 | 41 | echo "###########################################" 42 | echo "# Find available custom image #" 43 | echo "###########################################" 44 | echo "docker://$EDITOR_IMAGE*-base-$REPO_TAG" 45 | CUSTOM_IMAGES=`skopeo list-tags docker://$EDITOR_IMAGE \ 46 | | jq -r '.Tags[]' \ 47 | | grep -v '^ubuntu' \ 48 | | grep -e "-base-$REPO_TAG$" \ 49 | | xargs -I {} echo "$EDITOR_IMAGE:{}"` 50 | 51 | [ "$CUSTOM_IMAGES" = '' ] && echo "::warning::No custom images to request." && echo "::set-output name=exit::true" && exit 0 52 | echo "$CUSTOM_IMAGES" 53 | 54 | 55 | echo "###########################################" 56 | echo "# Setup build matrix #" 57 | echo "###########################################" 58 | CUSTOM_IMAGES=`echo "$CUSTOM_IMAGES" | paste -s -d ',' - | sed 's/,/\",\"/g' || :` 59 | matrix="{ \ 60 | \"customImage\":[\"$CUSTOM_IMAGES\"] \ 61 | }" 62 | echo "$matrix" 63 | echo "::set-output name=matrix::$matrix" 64 | echo "::set-output name=exit::false" 65 | 66 | request: 67 | name: Request for (${{ matrix.customImage }}) 68 | needs: setup 69 | if: needs.setup.outputs.exit != 'true' 70 | runs-on: ubuntu-18.04 71 | strategy: 72 | fail-fast: false 73 | matrix: ${{ fromJson(needs.setup.outputs.matrix) }} 74 | # The matrix is expanded like this: 75 | # matrix: 76 | # customImage: 77 | # - mob-sakai/unity3d:2018.3.0f2-base-v0.7.0 78 | # - mob-sakai/unity3d:2018.3.10f1-base-v0.7.0 79 | # ... 80 | steps: 81 | - uses: mob-sakai/unity-request-activation-file@custom_image 82 | with: 83 | customImage: ${{ matrix.customImage }} 84 | 85 | - uses: actions/upload-artifact@v2 86 | if: always() 87 | with: 88 | name: UnityActivationLicenseFiles 89 | path: "*.alf" 90 | 91 | release: 92 | name: Release ${{ github.event.inputs.repoTag }} 93 | if: startsWith(github.event.inputs.repoTag, 'v') 94 | needs: [setup, request] 95 | runs-on: ubuntu-18.04 96 | steps: 97 | - uses: actions/download-artifact@v2 98 | with: 99 | name: UnityActivationLicenseFiles 100 | path: UnityActivationLicenseFiles 101 | 102 | - uses: meeDamian/github-release@2.0 103 | with: 104 | token: ${{ github.token }} 105 | tag: ${{ github.event.inputs.repoTag }} 106 | gzip: true 107 | allow_override: true 108 | files: UnityActivationLicenseFiles/ 109 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE settings 2 | .idea/ 3 | node_modules 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | - Using welcoming and inclusive language 18 | - Being respectful of differing viewpoints and experiences 19 | - Gracefully accepting constructive criticism 20 | - Focusing on what is best for the community 21 | - Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | - The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | - Trolling, insulting/derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at webber@takken.io. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## How to contribute 4 | 5 | #### Code of Conduct 6 | 7 | This repository has adopted the Contributor Covenant as it's 8 | Code of Conduct. It is expected that participants adhere to it. 9 | 10 | #### Proposing a Change 11 | 12 | If you are unsure about whether or not a change is desired, 13 | you can create an issue. This is useful because it creates 14 | the possibility for a discussion that's visible to everyone. 15 | 16 | When fixing a bug it is fine to submit a pull request right away. 17 | 18 | #### Sending a Pull Request 19 | 20 | Steps to be performed to submit a pull request: 21 | 22 | 1. Fork the repository and create your branch from `main`. 23 | 2. Follow the readme to learn about the steps in Docker. 24 | 3. Fill out the description, link any related issues and submit your pull request. 25 | 26 | #### Pull Request Prerequisites 27 | 28 | You have verified that your changes in fact work. 29 | 30 | #### License 31 | 32 | By contributing to this repository, you agree that your contributions will be licensed under its MIT license. 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 mob-sakai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | :warning: NOTE: This project has been integrated into [mob-sakai/docker](https://github.com/mob-sakai/docker), so we are NOT continuing development in this repository. :warning: 2 | -- 3 | 4 |


5 |


6 |


7 |


8 | 9 | # Docker - Unity3d 10 | 11 | Source of CI specialised docker images for Unity. 12 | 13 | Inspired by [game-ci/docker](https://github.com/game-ci/docker). 14 | 15 |



16 | 17 | # :eight_spoked_asterisk: Changes from [game-ci/docker](https://github.com/game-ci/docker) 18 | 19 | * :warning: Removed features 20 | * backend-versioning server (Use `workflow_dispatch` and [unity-changeset](https://www.npmjs.com/package/unity-changeset) instead) 21 | * Unity project for test (Move to another branch) 22 | * Release automatically with [semantic-release](https://github.com/semantic-release/semantic-release) 23 | * The release is [based on a committed message](https://www.conventionalcommits.org/) 24 | * Tagging based on [Semantic Versioning 2.0.0](https://semver.org/) 25 | * Use `v1.0.0` insted of `v1.0` 26 | * Run workflow manually or automatically 27 | * Build all images on tag pushed 28 | * Build all editor images every 3 days 29 | * Run workflow manually from [Actions page](../../actions). 30 | * [:arrow_forward: Build All](../../actions?query=workflow%3A%22Build+All%22) 31 | * [:arrow_forward: Build Editor All](../../actions?query=workflow%3A%22Build+Editor+All%22) 32 | * [:arrow_forward: Build Editor](../../actions?query=workflow%3A%22Build+Editor%22) 33 | * Fast skip earlier builds of images that already exist 34 | * Support environment variables file (`.env`) for build settings 35 | * `DOCKER_REGISTRY` 36 | * `DOCKER_USERNAME` 37 | * `BASE_IMAGE` 38 | * `HUB_IMAGE` 39 | * `EDITOR_IMAGE` 40 | * `MINIMUM_UNITY_VERSION` 41 | * `IGNORED_UNITY_VERSIONS` 42 | * The build specifies an unstable version and prevents flooding of the error notifications 43 | * `IGNORED_IMAGE_TAGS` 44 | * Support for alpha/beta versions of Unity (e.g. 2020.2.0b, 2021.1.0a) 45 | * :warning: **NOTE: The versions removed from [Unity beta](https://unity3d.com/beta) will not be updated** 46 | * Grouping workflows in a module (base, ios, android, ...) 47 | * Improve the visibility of actions page 48 | * Easy to retry 49 | 50 |

51 | 52 | ## :hammer: How to build images 53 | 54 | ### 1. :pencil2: Setup build configuration file (`.env`) 55 | 56 | Overwrite `DOCKER_REGISTRY`, `DOCKER_USERNAME`, `BASE_IMAGE`, `HUB_IMAGE` and `EDITOR_IMAGE` in `.env`. 57 | 58 | ```sh 59 | # Docker Hub: docker.io 60 | # GitHub Container Registory: ghcr.io 61 | DOCKER_REGISTRY=ghcr.io 62 | DOCKER_USERNAME=mob-sakai 63 | 64 | # Full image ID 65 | BASE_IMAGE=ghcr.io/mob-sakai/unity_base 66 | HUB_IMAGE=ghcr.io/mob-sakai/unity_hub 67 | EDITOR_IMAGE=ghcr.io/mob-sakai/unity3d 68 | ``` 69 | 70 | Overwite `MINIMUM_UNITY_VERSION`, `IGNORED_UNITY_VERSIONS` and `IGNORED_IMAGE_TAGS` if you want. 71 | 72 | ```sh 73 | # Minimum Unity version 74 | MINIMUM_UNITY_VERSION=2018.3 75 | 76 | # Ignored Unity versions (Regular expressions) 77 | IGNORED_UNITY_VERSIONS=" 78 | ^2020.2.0a 79 | " 80 | 81 | # Ignored image tags (Regular expressions) 82 | IGNORED_IMAGE_TAGS=" 83 | ^2018.*linux-il2cpp 84 | ^2019.1.*linux-il2cpp 85 | ^2019.2.*linux-il2cpp 86 | " 87 | ``` 88 | 89 |

90 | 91 | ### 2. :key: Setup repository secrets 92 | 93 | | Name | Description | 94 | | -------------- | -------------------------------------------------------- | 95 | | `DOCKER_TOKEN` | The access token or passward to longin docker registory. | 96 | | `GH_WORKFLOW_TOKEN` | [Github parsonal access token][] to dispatch workflow. | 97 | 98 | [Github parsonal access token]: https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token 99 | 100 |

101 | 102 | ### 3. :arrow_forward: Run workflows (automatically) 103 | 104 | All workflows will be run automatically. 105 | 106 | | Workflow | Description | Trigger | Inputs | 107 | | --------------------------------- | ------------------------------------------------ | ----------------------------------------------------- | ------------------------------------------------------------------------------------ | 108 | | `Release` | Release new tag. | Pushed commits (include feat or fix) on `main` branch | - | 109 | | `Build All` | Build all images.
(base/hub/editor) | A new tag pushed | - | 110 | | `Build Editor` | Build editor images with a specific Unity module | Dispatched from `Build All` |
**module:** Unity module to build.
**repoTag:** The repository tag to build. | 111 | | `Request Activation License File` | Request Activation License File | Dispatched from `Build Editor (Base)` | **repoTag:** The repository tag to build. | 112 | 113 |

114 | 115 | ### 4. :arrow_forward: Run workflows (manually) 116 | 117 | You can run them manually from the [Actions page](../../actions). 118 | 119 | **NOTE: You need permissions to run the workflow.** 120 | 121 | * [:arrow_forward: Build All](../../actions?query=workflow%3A%22Build+All%22) 122 | * [:arrow_forward: Build Editor All](../../actions?query=workflow%3A%22Build+Editor+All%22) 123 | * [:arrow_forward: Build Editor](../../actions?query=workflow%3A%22Build+Editor%22) 124 | 125 | ![](https://user-images.githubusercontent.com/12690315/100829081-e454ac00-34a3-11eb-9aab-730e6a861c66.png) 126 | 127 |


128 | 129 | ## :wrench: Use custom image on Github Actions 130 | 131 | ```yml 132 | jobs: 133 | unity-test: 134 | runs-on: ubuntu-latest 135 | strategy: 136 | fail-fast: false 137 | matrix: 138 | unity: 139 | [ 140 | 2019.3.15f1, 141 | 2019.4.16f1, 142 | 2020.1.16f1, 143 | ] 144 | 145 | steps: 146 | - uses: actions/checkout@v2 147 | 148 | - uses: mob-sakai/unity-test-runner@main 149 | with: 150 | customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unity }} 151 | customParameters: "-nographics" 152 | testMode: editmode 153 | env: 154 | UNITY_LICENSE_FILE: .ulfs/Unity_v${{ matrix.unity }}.ulf 155 | 156 | - uses: actions/upload-artifact@v2 157 | if: failure() 158 | with: 159 | path: "*.alf" 160 | ``` 161 | 162 | https://unity-ci.com/docs/github/getting-started 163 | 164 | https://github.com/webbertakken/unity-actions 165 | 166 | Use with `CustomImage` parameter. 167 | 168 | * [Request Activation File (Marketplace)][RAF_Marketplace] ![][RAF_R] ![][RAF_PR] 169 | * [actions.yml][RAF_actions.yml] 170 | * [Repository][RAF_Repository] 171 | * [Test runner (Marketplace)][TR_Marketplace] ![][TR_R] ![][TR_PR] 172 | * [actions.yml][TR_actions.yml] 173 | * [Repository][TR_Repository] 174 | * [Builder (Marketplace)][B_Marketplace] ![][B_R] ![][B_PR] 175 | * [actions.yml][B_actions.yml] 176 | * [Repository][B_Repository] 177 | 178 | [RAF_R]: https://img.shields.io/github/v/release/webbertakken/unity-request-activation-file 179 | [RAF_PR]: https://img.shields.io/github/v/release/webbertakken/unity-request-activation-file?include_prereleases 180 | [RAF_actions.yml]: https://github.com/webbertakken/unity-request-activation-file/blob/main/action.yml 181 | [RAF_Repository]: https://github.com/webbertakken/unity-request-activation-file 182 | [RAF_Marketplace]: https://github.com/marketplace/actions/unity-request-activation-file 183 | 184 | [TR_R]: https://img.shields.io/github/v/release/webbertakken/unity-test-runner 185 | [TR_PR]: https://img.shields.io/github/v/release/webbertakken/unity-test-runner?include_prereleases 186 | [TR_actions.yml]: https://github.com/webbertakken/unity-test-runner/blob/master/action.yml 187 | [TR_Repository]: https://github.com/webbertakken/unity-test-runner 188 | [TR_Marketplace]: https://github.com/marketplace/actions/unity-test-runner 189 | 190 | [B_R]: https://img.shields.io/github/v/release/webbertakken/unity-builder 191 | [B_PR]: https://img.shields.io/github/v/release/webbertakken/unity-builder?include_prereleases 192 | [B_actions.yml]: https://github.com/webbertakken/unity-builder/blob/main/action.yml 193 | [B_Repository]: https://github.com/webbertakken/unity-builder 194 | [B_Marketplace]: https://github.com/marketplace/actions/unity-builder 195 | 196 |


197 | 198 | ## :mag: FAQ 199 | 200 | ### :exclamation: Error on time limit or API limit 201 | 202 | Because the combination of the editor build is so large, the builds may fail due to the time limit of github actions (<6 hours) or API limitations. 203 | 204 | Re-run `Build All` workflow manually after all jobs are done. 205 | 206 | ### :exclamation: Missing library for editor 207 | 208 | If a missing library is found, fix the `dockerfiles/editor.Dockerfile` in local. 209 | 210 | If the problem is solved, fix the `dockerfiles/base.Dockerfile` in the `main` branch. 211 | 212 |


213 | 214 | ## :bulb: Next plans 215 | 216 | * Test the build for each patch versions (2018.3.0, 2018.3.1, ...) 217 | * May be unnecessary for stable versions (2018.x, 2019.x) 218 | * Build a simple project for all platforms 219 | * Inspect the missing library 220 | * Notify the error summary to mail, Slack or Discord 221 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -ex 2 | 3 | source .env 4 | 5 | UNITY_VERSION=${1:-2021.1.0a7} 6 | MODULE=${2:-base} 7 | CHANGESET=`unity-changeset $UNITY_VERSION` 8 | 9 | REPO_LATEST_TAG=`git tag --sort='v:refname' \ 10 | | tail -n 1 \ 11 | | cut -d '/' -f 3` 12 | 13 | ARGUMETNS="$(echo \ 14 | --build-arg hubImage=$HUB_IMAGE:$REPO_LATEST_TAG \ 15 | --build-arg baseImage=$BASE_IMAGE:$REPO_LATEST_TAG \ 16 | --build-arg version=$UNITY_VERSION \ 17 | --build-arg changeSet=$CHANGESET \ 18 | --build-arg module=$MODULE \ 19 | --tag $EDITOR_IMAGE:$UNITY_VERSION-$MODULE-dev \ 20 | --tag $EDITOR_IMAGE:$UNITY_VERSION-$MODULE-$REPO_LATEST_TAG-dev \ 21 | )" 22 | 23 | if [ "$MODULE" = 'base'] ; then 24 | docker build -f dockerfiles/editor.Dockerfile $ARGUMETNS . 25 | else 26 | docker build -f dockerfiles/editor_module.Dockerfile $ARGUMETNS . 27 | fi 28 | -------------------------------------------------------------------------------- /config/asound.conf: -------------------------------------------------------------------------------- 1 | pcm.!default { 2 | type plug 3 | slave.pcm "null" 4 | } 5 | -------------------------------------------------------------------------------- /dockerfiles/base.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | # Global dependencies 4 | RUN apt-get -q update \ 5 | && apt-get -q install -y --no-install-recommends apt-utils \ 6 | && apt-get -q install -y --no-install-recommends --allow-downgrades \ 7 | ca-certificates \ 8 | libasound2 \ 9 | libc6-dev \ 10 | libcap2 \ 11 | libgconf-2-4 \ 12 | libglu1 \ 13 | libgtk-3-0 \ 14 | libncurses5 \ 15 | libnss3 \ 16 | libxtst6 \ 17 | libxss1 \ 18 | cpio \ 19 | lsb-release \ 20 | xvfb \ 21 | xz-utils \ 22 | && apt-get clean 23 | 24 | # Toolbox 25 | RUN apt-get -q update \ 26 | && apt-get -q install -y --no-install-recommends --allow-downgrades \ 27 | atop \ 28 | curl \ 29 | git \ 30 | git-lfs \ 31 | wget \ 32 | && git lfs install --system --skip-repo \ 33 | && apt-get clean 34 | 35 | # Disable default sound card, which removes ALSA warnings 36 | ADD config/asound.conf /etc/ 37 | 38 | # Support forward compatibility for unity activation 39 | RUN echo "576562626572264761624c65526f7578" > /etc/machine-id && mkdir -p /var/lib/dbus/ && ln -sf /etc/machine-id /var/lib/dbus/machine-id 40 | 41 | # Used by Unity editor in "modules.json" and must not end with a slash. 42 | ENV UNITY_PATH="/opt/unity" 43 | -------------------------------------------------------------------------------- /dockerfiles/editor.Dockerfile: -------------------------------------------------------------------------------- 1 | ARG hubImage 2 | ARG baseImage 3 | 4 | ########################### 5 | # Builder # 6 | ########################### 7 | 8 | FROM $hubImage AS builder 9 | 10 | # Install editor 11 | ARG version 12 | ARG changeSet 13 | RUN unity-hub install --version "$version" --changeset "$changeSet" 2>&1 | tee hub.log \ 14 | && cat hub.log | grep 'Error' | exit $(wc -l) 15 | 16 | ########################### 17 | # Editor # 18 | ########################### 19 | 20 | FROM $baseImage 21 | 22 | # Always put "Editor" and "modules.json" directly in $UNITY_PATH 23 | ARG version 24 | COPY --from=builder /opt/unity/editors/$version/ "$UNITY_PATH/" 25 | 26 | # Add a file containing the version for this build 27 | RUN echo $version > "$UNITY_PATH/version" 28 | 29 | # Alias to "unity-editor" with default params 30 | RUN echo '#!/bin/bash\nxvfb-run -ae /dev/stdout --server-args='-screen 0 640x480x24' "$UNITY_PATH/Editor/Unity" -batchmode "$@"' > /usr/bin/unity-editor \ 31 | && chmod +x /usr/bin/unity-editor 32 | -------------------------------------------------------------------------------- /dockerfiles/editor_module.Dockerfile: -------------------------------------------------------------------------------- 1 | ARG hubImage 2 | ARG baseImage 3 | ARG editorBaseImage 4 | 5 | ########################### 6 | # Builder # 7 | ########################### 8 | 9 | FROM $editorBaseImage AS editorBase 10 | FROM $hubImage AS builder 11 | 12 | # Install module 13 | ARG version 14 | COPY --from=editorBase "$UNITY_PATH/" /opt/unity/editors/$version/ 15 | 16 | ARG changeSet 17 | ARG module="non-existent-module" 18 | RUN unity-hub install-modules --version "$version" --module "$module" --childModules 2>&1 | tee hub.log \ 19 | && cat hub.log | grep 'Missing module' | exit $(wc -l) 20 | 21 | ########################### 22 | # Editor # 23 | ########################### 24 | 25 | FROM $baseImage 26 | 27 | # Always put "Editor" and "modules.json" directly in $UNITY_PATH 28 | ARG version 29 | COPY --from=builder /opt/unity/editors/$version/ "$UNITY_PATH/" 30 | 31 | -------------------------------------------------------------------------------- /dockerfiles/hub.Dockerfile: -------------------------------------------------------------------------------- 1 | ARG baseImage 2 | FROM $baseImage 3 | 4 | # Hub dependencies 5 | RUN apt-get -q update \ 6 | && apt-get -q install -y --no-install-recommends --allow-downgrades zenity \ 7 | && apt-get clean 8 | 9 | # Download & extract AppImage 10 | RUN wget --no-verbose -O /tmp/UnityHub.AppImage "https://public-cdn.cloud.unity3d.com/hub/prod/UnityHub.AppImage" \ 11 | && chmod +x /tmp/UnityHub.AppImage \ 12 | && cd /tmp \ 13 | && /tmp/UnityHub.AppImage --appimage-extract \ 14 | && cp -R /tmp/squashfs-root/* / \ 15 | && rm -rf /tmp/squashfs-root /tmp/UnityHub.AppImage \ 16 | && mkdir -p "$UNITY_PATH" \ 17 | && mv /AppRun /opt/unity/UnityHub 18 | 19 | # Alias to "unity-hub" with default params 20 | RUN echo '#!/bin/bash\nxvfb-run -ae /dev/stdout /opt/unity/UnityHub --no-sandbox --headless "$@"' > /usr/bin/unity-hub \ 21 | && chmod +x /usr/bin/unity-hub 22 | 23 | # Accept 24 | RUN mkdir -p "/root/.config/Unity Hub" \ 25 | && touch "/root/.config/Unity Hub/eulaAccepted" 26 | 27 | # Configure 28 | RUN mkdir -p "${UNITY_PATH}/editors" \ 29 | && unity-hub install-path --set "${UNITY_PATH}/editors/" \ 30 | && find /tmp -mindepth 1 -delete 31 | -------------------------------------------------------------------------------- /media/Discord-Logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@mob-sakai/docker-unity", 3 | "version": "1.0.0", 4 | "description": "New series of CI-specialised docker images for Unity. Superseding the famous gableroux/unity3d images.", 5 | "license": "MIT", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/mob-sakai/docker-unity.git" 9 | }, 10 | "author": "mob-sakai (https://github.com/mob-sakai)", 11 | "scripts": { 12 | "package:format": "npx format-package -w", 13 | "package:update": "npx ncu -u && npm install && npm audit fix", 14 | "release": "semantic-release", 15 | "release:debug": "semantic-release --debug --dry-run -no-ci" 16 | }, 17 | "release": { 18 | "branches": [ 19 | "+([0-9])?(.{+([0-9]),x}).x", 20 | "main" 21 | ], 22 | "plugins": [ 23 | "@semantic-release/commit-analyzer", 24 | "@semantic-release/release-notes-generator", 25 | "@semantic-release/changelog", 26 | "@semantic-release/github" 27 | ] 28 | }, 29 | "dependencies": { 30 | "@semantic-release/changelog": "^5.0.1", 31 | "semantic-release": "^17.3.0" 32 | } 33 | } 34 | --------------------------------------------------------------------------------