diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 84a98c02..dd61a67a 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: 18 - uses: c-hive/gha-yarn-cache@v2 - run: yarn - run: yarn verify:formatting @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: 18 - uses: c-hive/gha-yarn-cache@v2 - run: yarn - run: yarn verify:code-styles @@ -34,7 +34,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: 18 - uses: c-hive/gha-yarn-cache@v2 - run: yarn - run: yarn typecheck @@ -45,7 +45,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: 18 - uses: c-hive/gha-yarn-cache@v2 - run: yarn - run: yarn test --coverage diff --git a/.github/workflows/search-trigger.yml b/.github/workflows/search-trigger.yml index 63f6cb5b..a2828301 100644 --- a/.github/workflows/search-trigger.yml +++ b/.github/workflows/search-trigger.yml @@ -6,7 +6,7 @@ jobs: name: Update search index runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: darrenjennings/algolia-docsearch-action@da2ed379c147b356d60dbfec68bdcfacb2791a98 with: algolia_application_id: 'E57FOT37U9' diff --git a/.idea/prettier.xml b/.idea/prettier.xml index 727b8b53..60c07b5a 100644 --- a/.idea/prettier.xml +++ b/.idea/prettier.xml @@ -1,6 +1,7 @@ + diff --git a/docs/03-github/01-getting-started.mdx b/docs/03-github/01-getting-started.mdx index 82219a9d..ab67b097 100644 --- a/docs/03-github/01-getting-started.mdx +++ b/docs/03-github/01-getting-started.mdx @@ -98,7 +98,7 @@ jobs: # Build - name: Build project - uses: game-ci/unity-builder@v2 + uses: game-ci/unity-builder@v3 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} @@ -168,7 +168,7 @@ jobs: # Build - name: Build project - uses: game-ci/unity-builder@v2 + uses: game-ci/unity-builder@v3 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} @@ -248,7 +248,7 @@ jobs: path: ${{ steps.testRunner.outputs.artifactsPath }} - if: matrix.targetPlatform == 'Android' uses: jlumbroso/free-disk-space@v1.2.0 - - uses: game-ci/unity-builder@v2 + - uses: game-ci/unity-builder@v3 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} @@ -295,7 +295,7 @@ jobs: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}- Library-${{ matrix.projectPath }}- Library- - - uses: game-ci/unity-builder@v2 + - uses: game-ci/unity-builder@v3 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} @@ -341,7 +341,7 @@ jobs: Library-${{ matrix.projectPath }}- Library- - - uses: game-ci/unity-builder@v2 + - uses: game-ci/unity-builder@v3 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} diff --git a/docs/03-github/02-activation.mdx b/docs/03-github/02-activation.mdx index 9cf108fd..96f60347 100644 --- a/docs/03-github/02-activation.mdx +++ b/docs/03-github/02-activation.mdx @@ -105,7 +105,7 @@ floating license will be acquired before the build, and returned after. Example of use: ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: targetPlatform: WebGL unityLicensingServer: [url to your license server] diff --git a/docs/03-github/04-builder.mdx b/docs/03-github/04-builder.mdx index fe7755fd..8f33c0a9 100644 --- a/docs/03-github/04-builder.mdx +++ b/docs/03-github/04-builder.mdx @@ -40,7 +40,7 @@ secret. Then, define the build step as follows: ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} @@ -60,7 +60,7 @@ Make sure you have set up these variables in the activation step: Then, define the build step as follows: ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 env: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} @@ -77,7 +77,7 @@ If you host your own Unity license server internally you can provide its url usi Example of use: ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: targetPlatform: WebGL unityLicensingServer: [url to your license server] @@ -152,7 +152,7 @@ _**required:** `false`_ _**default:** `auto`_ Specific docker image that should be used for building the project. ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: customImage: 'unityci/editor:2020.1.14f1-base-0' ``` @@ -192,7 +192,7 @@ There are two conditions for a custom buildMethod: Example: ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: buildMethod: EditorNamespace.BuilderClassName.StaticBuildMethod ``` @@ -202,7 +202,7 @@ To get started with a modified version of the default Unity Builder build script `Assets/Editor/UnityBuilderAction` directory and reference it: ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: buildMethod: UnityBuilderAction.BuildScript.Build ``` @@ -220,7 +220,7 @@ Parameters must start with a hyphen (`-`) and may be followed by a value (withou Parameters without a value will be considered booleans (with a value of true). ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: customParameters: -profile SomeProfile -someBoolean -someValue exampleValue ``` @@ -238,7 +238,7 @@ _**required:** `false`_ _**default:** `""`_ Configure a specific versioning strategy ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: versioning: Semantic ``` @@ -298,7 +298,7 @@ Set this flag to `androidPackage` to build an apk, `androidAppBundle` for an aab `androidStudioProject` to build an Android Studio Project. ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: androidExportType: 'androidAppBundle' androidKeystoreName: user.keystore @@ -308,33 +308,12 @@ Set this flag to `androidPackage` to build an apk, `androidAppBundle` for an aab androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }} ``` -You should also set all the Android Keystore options (see below). Refer to (this -section)[/docs/github/deployment/android#3-generate-an-upload-key-and-keystore] for keystore setup. +You should also set all the Android Keystore options (see below). Refer to +[this section](/docs/github/deployment/android#3-generate-an-upload-key-and-keystore) for keystore +setup. _**required:** `false`_ _**default:** `androidPackage`_ -#### androidAppBundle - -**[Deprecated] Please use androidExportType instead.** - -Set this flag to `true` to build '.aab' instead of '.apk'. - -```yaml -- uses: game-ci/unity-builder@v2 - with: - androidAppBundle: true - androidKeystoreName: user.keystore - androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} - androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }} - androidKeyaliasName: ${{ secrets.ANDROID_KEYALIAS_NAME }} - androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }} -``` - -You should also set all the Android Keystore options (see below). Refer to (this -section)[/docs/github/deployment/android#3-generate-an-upload-key-and-keystore] for keystore setup. - -_**required:** `false`_ _**default:** `false`_ - #### androidKeystoreName Configure the android `keystoreName`. Must be provided if configuring the below keystore options. @@ -417,7 +396,7 @@ _**required:** `false`_ _**default:** `""`_ Allows the branch of the build to be dirty, and still generate the build. ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 with: allowDirtyBuild: true ``` @@ -447,6 +426,20 @@ ie `3.4.0`. An empty string represents the latest available version on homebrew. _**required:** `false`_ _**default:** `""`_ +#### dockerWorkspacePath + +Allows customizing the build path within the container in case there are hardcoded paths generated +during the build. For example building an IOS XCode project on Linux and moving to a new path on +MacOS occasionally leads to broken paths requiring this override to ensure the paths match. + +Paths should be of format `/path/to/build`, ie `/tmp/build`. On Windows, leave off the drive letter +specification. For example `C:\build` becomes `/build`. There should be no trailing slash in the +path and the path should be absolute. The path will automatically be created within the container if +it does not exist. It is recommended to use a path that doesn't already exist within the container +to avoid any conflicts. + +_**required:** `false`_ _**default:** `"/github/workspace"`_ + ## Outputs Below are outputs that can be accessed by using `${{ steps.myBuildStep.outputs.outputName }}`, where @@ -458,7 +451,7 @@ Returns the version that was generated by Builder, following the strategy config `versioning`. ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 id: myBuildStep - run: echo 'Project Version: ${{ steps.myBuildStep.outputs.buildVersion }}' ``` @@ -468,7 +461,7 @@ Returns the version that was generated by Builder, following the strategy config Returns the version code that was generated by Builder for Android builds. ```yaml -- uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v3 id: myBuildStep - run: echo 'Android Version Code: ${{ steps.myBuildStep.outputs.androidVersionCode }}' ``` @@ -507,7 +500,7 @@ steps: - uses: webfactory/ssh-agent@v0.8.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - uses: game-ci/unity-builder@v2 + - uses: game-ci/unity-builder@v3 with: sshAgent: ${{ env.SSH_AUTH_SOCK }} ``` @@ -565,7 +558,7 @@ jobs: restore-keys: Library- - if: matrix.targetPlatform == 'Android' uses: jlumbroso/free-disk-space@v1.2.0 - - uses: game-ci/unity-builder@v2 + - uses: game-ci/unity-builder@v3 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} with: diff --git a/docs/03-github/06-deployment/android.mdx b/docs/03-github/06-deployment/android.mdx index 6fca0f8a..6d001b2c 100644 --- a/docs/03-github/06-deployment/android.mdx +++ b/docs/03-github/06-deployment/android.mdx @@ -172,7 +172,7 @@ jobs: with: path: Library key: Library-Android - - uses: game-ci/unity-builder@v2 + - uses: game-ci/unity-builder@v3 with: targetPlatform: Android androidAppBundle: true diff --git a/docs/03-github/06-deployment/ios.mdx b/docs/03-github/06-deployment/ios.mdx index 876f4dce..fd1b734b 100644 --- a/docs/03-github/06-deployment/ios.mdx +++ b/docs/03-github/06-deployment/ios.mdx @@ -436,7 +436,7 @@ jobs: path: Library key: Library-iOS - - uses: game-ci/unity-builder@v2 + - uses: game-ci/unity-builder@v3 with: targetPlatform: iOS diff --git a/docs/03-github/06-deployment/steam.mdx b/docs/03-github/06-deployment/steam.mdx index 58fe93cc..a5a95049 100644 --- a/docs/03-github/06-deployment/steam.mdx +++ b/docs/03-github/06-deployment/steam.mdx @@ -40,7 +40,7 @@ jobs: restore-keys: | Library-${{ matrix.targetPlatform }}- Library- - - uses: game-ci/unity-builder@v2 + - uses: game-ci/unity-builder@v3 id: build env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} diff --git a/docs/09-troubleshooting/common-issues.mdx b/docs/09-troubleshooting/common-issues.mdx index fe3a1a0e..9fd112c9 100644 --- a/docs/09-troubleshooting/common-issues.mdx +++ b/docs/09-troubleshooting/common-issues.mdx @@ -92,11 +92,11 @@ here][unity-docker-versions]. In this particular case, it is also important to look for the last part of the docker image which is the version for GameCI. `-0` means it is the latest `v0.x.x` version of the docker images. `v0.x.x` -version is out of date as we moved to Version 1 as shown on +and `v1.x.x` are out of date as we moved to Version 2 as shown on [github.com/game-ci/docker/releases](https://github.com/game-ci/docker/releases). We are not -publishing images for `v0.x.x` anymore. +publishing images for `v0.x.x` or `v1.x.x` anymore. -The correct image should be `unityci/editor:2021.3.0f1-android-1`. +The correct image should be `unityci/editor:2021.3.0f1-android-2`. You can also test this locally: @@ -106,24 +106,24 @@ docker pull unityci/editor:2021.3.0f1-android-0 # Error response from daemon: manifest for unityci/editor:2021.3.0f1-android-0 not found: manifest unknown: manifest unknown # right -docker pull unityci/editor:2021.3.0f1-android-1 -# 2021.3.0f1-android-1: Pulling from unityci/editor +docker pull unityci/editor:2021.3.0f1-android-2 +# 2021.3.0f1-android-2: Pulling from unityci/editor # [...] ``` #### Github Actions -You need to make sure you are using Github Actions v2, check for the version of your actions in your +You need to make sure you are using Github Actions v3, check for the version of your actions in your `.github/workflows/*.yml` files. ```diff -- uses: game-ci/unity-builder@v1 -+ uses: game-ci/unity-builder@v2 +- uses: game-ci/unity-builder@v2 ++ uses: game-ci/unity-builder@v3 ``` #### Gitlab CI -Set the `IMAGE_VERSION` to 1 in +Set the `IMAGE_VERSION` to 2 in [`.gitlab-ci.yml`](https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/.gitlab-ci.yml#L12) ### Scripts have compiler errors. diff --git a/docusaurus.config.js b/docusaurus.config.js index 663d4242..9311baf4 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -49,7 +49,10 @@ const config = { lastVersion: 'current', versions: { current: { - label: 'v2 (current)', + label: 'v3 (current)', + }, + 2: { + label: 'v2', }, 1: { label: 'v1', diff --git a/lefthook.yml b/lefthook.yml index 433070b9..73fbb846 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -27,9 +27,10 @@ pre-commit: format code: glob: '*.{js,jsx,ts,tsx}' exclude: '.docusaurus/|build/' - run: - yarn prettier --write {staged_files} && yarn eslint --stdin-filename {staged_files} && git - add {staged_files} + run: | + yarn prettier --write {staged_files} + yarn eslint --stdin-filename {staged_files} + git add {staged_files} type check: glob: '*.{ts,tsx,scss}' exclude: '.docusaurus/|build/' diff --git a/package.json b/package.json index c59a9aae..163638db 100644 --- a/package.json +++ b/package.json @@ -30,19 +30,19 @@ "typecheck": "tsc" }, "dependencies": { - "@docusaurus/core": "^0.0.0-5035", - "@docusaurus/module-type-aliases": "^0.0.0-5035", - "@docusaurus/preset-classic": "^0.0.0-5035", - "@docusaurus/theme-common": "^0.0.0-5035", + "@docusaurus/core": "^2.4.1", + "@docusaurus/module-type-aliases": "^2.4.1", + "@docusaurus/preset-classic": "^2.4.1", + "@docusaurus/theme-common": "^2.4.1", "@mdx-js/react": "^1.6.22", "@reduxjs/toolkit": "^1.8.1", - "@tsconfig/docusaurus": "^1.0.5", + "@docusaurus/tsconfig": "^3.0.0-alpha.0", "antd": "^4.20.2", "autoprefixer": "^10.4.12", "classnames": "^2.3.2", "clsx": "^1.1.1", "docusaurus-gtm-plugin": "^0.0.2", - "docusaurus-plugin-sass": "^0.2.2", + "docusaurus-plugin-sass": "^0.2.5", "firebase": "^8.2.9", "postcss": "^8.4.18", "prism-react-renderer": "^1.3.1", @@ -50,7 +50,7 @@ "react": "^17.0.2", "react-dom": "^17.0.2", "react-hot-toast": "^2.2.0", - "react-icons": "^4.3.1", + "react-icons": "^4.10.1", "react-instantsearch-dom": "^6.24.0", "react-player": "^2.10.0", "react-redux": "^8.0.1", @@ -68,16 +68,16 @@ "@arkweid/lefthook": "^0.7.7", "@testing-library/react": "^13.2.0", "@types/jest": "^27.5.1", - "@typescript-eslint/eslint-plugin": "^5.26.0", - "@typescript-eslint/parser": "^5.25.0", + "@typescript-eslint/eslint-plugin": "^6.4.0", + "@typescript-eslint/parser": "^6.4.0", "concurrently": "^7.2.1", "eslint": "^7.19.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-airbnb-typescript": "^12.3.1", "eslint-config-prettier": "^7.2.0", - "eslint-import-resolver-typescript": "^2.3.0", + "eslint-import-resolver-typescript": "^3.6.0", "eslint-plugin-flowtype": "^5.2.0", - "eslint-plugin-import": "^2.22.1", + "eslint-plugin-import": "^2.28.0", "eslint-plugin-jest": "^26.2.2", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^3.3.1", @@ -100,5 +100,9 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "volta": { + "node": "20.5.1", + "yarn": "1.22.19" } } diff --git a/src/components/auth/safe-auth-check.tsx b/src/components/auth/safe-auth-check.tsx index fa0eb5f2..4fa6523a 100644 --- a/src/components/auth/safe-auth-check.tsx +++ b/src/components/auth/safe-auth-check.tsx @@ -1,6 +1,6 @@ -import firebase from 'firebase'; import React from 'react'; import { AuthCheckProps, ClaimsCheckProps, useIdTokenResult, useUser } from 'reactfire'; +import firebase from 'firebase'; // Apply fix while this is not merged https://github.com/FirebaseExtended/reactfire/pull/336 export function SafeClaimsCheck({ user, fallback, children, requiredClaims }: ClaimsCheckProps) { diff --git a/src/components/auth/sign-in-sign-out-button.tsx b/src/components/auth/sign-in-sign-out-button.tsx index 8303f984..a498a55e 100644 --- a/src/components/auth/sign-in-sign-out-button.tsx +++ b/src/components/auth/sign-in-sign-out-button.tsx @@ -1,9 +1,9 @@ import { Button } from 'antd'; -import firebase from 'firebase/app'; import React from 'react'; import { useState } from 'react'; -import { AiOutlineClose, AiTwotoneLock } from 'react-icons/all'; +import { AiOutlineClose, AiTwotoneLock } from 'react-icons/ai'; import { useAuth, AuthCheck } from 'reactfire'; +import firebase from 'firebase/app'; const loadingDelay = async (delayMs = 100) => { return new Promise((resolve) => setTimeout(() => resolve('loading'), delayMs)); diff --git a/src/components/docs/versions/docker-image-link-or-retry-button.tsx b/src/components/docs/versions/docker-image-link-or-retry-button.tsx index 133955f6..bbd02291 100644 --- a/src/components/docs/versions/docker-image-link-or-retry-button.tsx +++ b/src/components/docs/versions/docker-image-link-or-retry-button.tsx @@ -1,10 +1,10 @@ +import { Tooltip } from 'antd'; +import React, { useState } from 'react'; +import { HiOutlineRefresh } from 'react-icons/hi'; import { SimpleAuthCheck } from '@site/src/components/auth/safe-auth-check'; import DockerImageLink from '@site/src/components/docs/versions/docker-image-link'; import { useAuthenticatedEndpoint } from '@site/src/core/hooks/use-authenticated-endpoint'; import { useNotification } from '@site/src/core/hooks/use-notification'; -import { Tooltip } from 'antd'; -import React, { useState } from 'react'; -import { HiOutlineRefresh } from 'react-icons/all'; import Spinner from '@site/src/components/molecules/spinner'; interface Props { diff --git a/src/components/docs/versions/docker-image-link.tsx b/src/components/docs/versions/docker-image-link.tsx index 1a32bcdc..8d545d02 100644 --- a/src/components/docs/versions/docker-image-link.tsx +++ b/src/components/docs/versions/docker-image-link.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { SiDocker } from 'react-icons/all'; +import { SiDocker } from 'react-icons/si'; interface Props { imageRepo: string; diff --git a/src/components/docs/versions/image-versions.tsx b/src/components/docs/versions/image-versions.tsx index c09b000a..87af2cbd 100644 --- a/src/components/docs/versions/image-versions.tsx +++ b/src/components/docs/versions/image-versions.tsx @@ -1,6 +1,6 @@ -import SignInSignOutButton from '@site/src/components/auth/sign-in-sign-out-button'; import { Select } from 'antd'; import React, { useState } from 'react'; +import SignInSignOutButton from '@site/src/components/auth/sign-in-sign-out-button'; import UnityVersions from './unity-versions'; const { Option } = Select; diff --git a/src/components/docs/versions/unity-version.tsx b/src/components/docs/versions/unity-version.tsx index 8f7081fb..2cdcac88 100644 --- a/src/components/docs/versions/unity-version.tsx +++ b/src/components/docs/versions/unity-version.tsx @@ -1,9 +1,9 @@ +import React from 'react'; +import { Collapse } from 'antd'; import Builds from '@site/src/components/docs/versions/builds'; import DateTime from '@site/src/components/docs/versions/date-time'; import ShowAndCopyChangeSetHashButton from '@site/src/components/docs/versions/show-and-copy-change-set-hash-button'; import Spinner from '@site/src/components/molecules/spinner'; -import React from 'react'; -import { Collapse } from 'antd'; const { Panel } = Collapse; diff --git a/src/components/docs/versions/versions.tsx b/src/components/docs/versions/versions.tsx index 884ec91b..a8e802e2 100644 --- a/src/components/docs/versions/versions.tsx +++ b/src/components/docs/versions/versions.tsx @@ -1,7 +1,7 @@ -import isServer from '@site/src/core/is-server'; -import ImageVersions from '@site/src/components/docs/versions/image-versions'; import React from 'react'; import { useFirestore, useFirestoreCollectionData } from 'reactfire'; +import isServer from '@site/src/core/is-server'; +import ImageVersions from '@site/src/components/docs/versions/image-versions'; const Versions = () => { const loading =

Fetching versions...

; diff --git a/src/components/molecules/spinner.tsx b/src/components/molecules/spinner.tsx index 4ead953d..83e4738b 100644 --- a/src/components/molecules/spinner.tsx +++ b/src/components/molecules/spinner.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { AiOutlineLoading3Quarters, FaSpinner } from 'react-icons/all'; +import { AiOutlineLoading3Quarters } from 'react-icons/ai'; +import { FaSpinner } from 'react-icons/fa'; import { ThreeDots } from '@site/src/components/molecules/spinner/three-dots'; import styles from './spinner.module.scss'; diff --git a/src/components/pages/home/section/getting-started.tsx b/src/components/pages/home/section/getting-started.tsx index aba3da85..b03e3de7 100644 --- a/src/components/pages/home/section/getting-started.tsx +++ b/src/components/pages/home/section/getting-started.tsx @@ -1,8 +1,8 @@ -import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view'; import Link from '@docusaurus/Link'; import React from 'react'; -import styles from '@site/src/components/pages/home/section/section.module.scss'; import cx from 'classnames'; +import styles from '@site/src/components/pages/home/section/section.module.scss'; +import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view'; import Section from '@site/src/components/pages/home/section/section'; const GettingStarted = () => { diff --git a/src/components/pages/home/section/opening-section.tsx b/src/components/pages/home/section/opening-section.tsx index b85158b8..28494d48 100644 --- a/src/components/pages/home/section/opening-section.tsx +++ b/src/components/pages/home/section/opening-section.tsx @@ -1,8 +1,8 @@ import React, { createRef } from 'react'; import { Typography } from 'antd'; +import { useColorMode } from '@docusaurus/theme-common'; import GameCiLogo from '@site/static/assets/images/game-ci-brand-logo-wordmark.svg'; import GameCiLogoLight from '@site/static/assets/images/game-ci-brand-logo-wordmark-light.svg'; -import { useColorMode } from '@docusaurus/theme-common'; import Section from '@site/src/components/pages/home/section/section'; import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view'; import styles from './section.module.scss'; diff --git a/src/components/pages/home/section/sponsors-section.tsx b/src/components/pages/home/section/sponsors-section.tsx index 31d7d5d3..30803549 100644 --- a/src/components/pages/home/section/sponsors-section.tsx +++ b/src/components/pages/home/section/sponsors-section.tsx @@ -1,9 +1,9 @@ -import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view'; import Link from '@docusaurus/Link'; import React from 'react'; +import cx from 'classnames'; +import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view'; import styles from '@site/src/components/pages/home/section/section.module.scss'; import Section from '@site/src/components/pages/home/section/section'; -import cx from 'classnames'; const SponsorsSection = () => { return ( diff --git a/src/components/pages/home/section/the-perks-section.tsx b/src/components/pages/home/section/the-perks-section.tsx index 54d957c1..9bb0c408 100644 --- a/src/components/pages/home/section/the-perks-section.tsx +++ b/src/components/pages/home/section/the-perks-section.tsx @@ -1,7 +1,7 @@ import React from 'react'; +import cx from 'classnames'; import Section from '@site/src/components/pages/home/section/section'; import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view'; -import cx from 'classnames'; import styles from './section.module.scss'; const cards = [ diff --git a/src/core/hooks/use-authenticated-endpoint.tsx b/src/core/hooks/use-authenticated-endpoint.tsx index cd914a46..40881b79 100644 --- a/src/core/hooks/use-authenticated-endpoint.tsx +++ b/src/core/hooks/use-authenticated-endpoint.tsx @@ -1,5 +1,5 @@ -import config from '@site/src/core/config'; import { useUser } from 'reactfire'; +import config from '@site/src/core/config'; export function useAuthenticatedEndpoint(endpoint: string, payload: { [key: string]: any }) { const { data: user } = useUser(); diff --git a/src/pages/docs/docker/versions.tsx b/src/pages/docs/docker/versions.tsx index 9ff8f9ff..54d73553 100644 --- a/src/pages/docs/docker/versions.tsx +++ b/src/pages/docs/docker/versions.tsx @@ -1,9 +1,9 @@ import React from 'react'; import Layout from '@theme/Layout'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import Versions from '@site/src/components/docs/versions/versions'; - import { useColorMode } from '@docusaurus/theme-common'; +import BrowserOnly from '@docusaurus/BrowserOnly'; +import Versions from '@site/src/components/docs/versions/versions'; import Section from '@site/src/components/pages/home/section/section'; import styles from '@site/src/components/pages/home/section/section.module.scss'; @@ -51,7 +51,9 @@ export default function VersionsPage(): JSX.Element { >
- + Loading...}> + {() => } +
diff --git a/src/theme/Root.tsx b/src/theme/Root.tsx index 48fe64ff..f0ce32a4 100644 --- a/src/theme/Root.tsx +++ b/src/theme/Root.tsx @@ -5,9 +5,9 @@ import { IconContext } from 'react-icons'; import { Provider } from 'react-redux'; import { configureStore } from '@reduxjs/toolkit'; import { FirebaseAppProvider } from 'reactfire'; +import { Toaster } from 'react-hot-toast'; import config from '@site/src/core/config'; import { reducer } from '@site/src/logic'; -import { Toaster } from 'react-hot-toast'; const store = configureStore({ reducer }); diff --git a/tsconfig.json b/tsconfig.json index 44f6107b..47f91f5e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,9 @@ { // This file is not used in compilation. It is here just for a nice editor experience. - "extends": "@tsconfig/docusaurus/tsconfig.json", + "extends": "@docusaurus/tsconfig/tsconfig.json", "compilerOptions": { "baseUrl": ".", - "skipLibCheck": true + "skipLibCheck": true, + "moduleResolution": "node" } } diff --git a/versioned_docs/version-2/02-getting-started/index.mdx b/versioned_docs/version-2/02-getting-started/index.mdx new file mode 100644 index 00000000..ac28d8af --- /dev/null +++ b/versioned_docs/version-2/02-getting-started/index.mdx @@ -0,0 +1,39 @@ +# Getting started + +The term for automatically testing, building, and deploying your project is Continuous Integration, +or CI for short. + +The configuration for CI, we commonly call a CI-workflow. + +To get started creating your workflow, you need 3 things: + +- A Unity project +- A Git host (GitHub, GitLab, your private server, etc.) +- A CI system (GitHub Actions, GitLab pipelines, CircleCI, TravisCI, Jenkins, etc.) + +## Preparing the project + +**Create a repository** on your chosen Git host and follow their instructions to commit and push +your project. + +Be sure to **ignore any automatically generated files**, by adding the reference +[.gitignore](https://github.com/github/gitignore/blob/master/Unity.gitignore) file to the root of +your project. Please note that you may have to extend this file to ignore the temporary files +created by the runners, as the creation of these temporary files may cause a runners' local branch +to become dirty (more info [here](/docs/troubleshooting/common-issues#branch-is-dirty])): + +Two common temporary folders that are created by GameCI are `artifacts` and `CodeCoverage`. You can +ignore them by adding the following lines to your `.gitignore`: + +``` +# Ignore temporaries from GameCI +/[Aa]rtifacts/ +/[Cc]odeCoverage/ +``` + +To **ensure large files are handled correctly** (in [LFS](https://git-lfs.github.com/)), you can add +our reference +[.gitattributes](https://gist.github.com/webbertakken/ff250a0d5e59a8aae961c2e509c07fbc) file to the +root of your project. + +You are now **ready** to create a workflow! Choose the CI system you chose in the menu on the left. diff --git a/versioned_docs/version-2/03-github-cloud-runner/01-introduction.mdx b/versioned_docs/version-2/03-github-cloud-runner/01-introduction.mdx new file mode 100644 index 00000000..f83e2103 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/01-introduction.mdx @@ -0,0 +1,104 @@ +# Introduction + +## Concept - What Does Cloud Runner Do + +**Cloud Runner enables you to run, build and test (Unity) projects in the cloud. You can start jobs +from the command line, the "Workbench" GUI in the Unity Editor or from GitHub Actions.** + +**Cloud Runner will automatically provision an environment at a Cloud Provider such as GCP and AWS. +It will then send the project to be built and/or tested depending on your workflow configuration.** + +**Cloud Runner is especially useful for game development because it supports large projects. Cloud +Runner provides first class support for the Unity game engine.** + +Cloud Runner uses git to track and syncronize your projects and uses native cloud services such as +AWS Fargate and Kubernetes to run your jobs. Other version control systems are not actively +supported. + +## Why Cloud Runner? + +1. **Cloud runner is flexible and elastic** + 1. _You can balance your use of high-performance and cost saving modes._ Configurable cost/speed + effeciency + 2. _Works great for projects of almost any size, from AAA projects and assets to micro projects_ + 3. _Extended configuration options._ More control over disk size, memory and CPU + 4. _Easily scale all job resources as your project grows_ e.g storage, CPU and memory +2. **Scale fully on demand from zero (not in use) to many concurrent jobs.** Benefits from + "pay-for-what-you-use" cloud billing models. We have made an effort to make sure that it costs + you nothing (aside from artifact and cache storage) while there are no builds running (no + guarantees) +3. **Easy setup and configuration** +4. **Run custom jobs** and extend the system for any workload + +## Why not cloud runner? + +1. Your project is small in size. Below 5GB Cloud Runner should not be needed. +2. You already have dedicated servers running you can use. + +Although the speed of a CI pipelines is an important metric to consider, there are real challenges +for game development pipelines. + +This solution prefers convenience, ease of use, scalability, throughput and flexibility. + +Faster solutions exist, but would all involve self-hosted hardware with an immediate local cache of +the large project files and working directory and a dedicated server. + +# Cloud Runner Release Status + +Cloud Runner is in "active development" ⚠️🔨 + +Cloud Runner overall release status: `preview` This means some APIs may change, features are still +being added but the minimum feature set works and is stable. + +Release Stages: `experimental` ➡️ `preview` ➡️ `full release` + +You must use a provider with Cloud Runner, each provider's release status is described below. This +indicates the stability and support for cloud runner features and workflows. + +### Supported Cloud Runner Platforms + +```md +| Cloud Provider Platform | Release Status | +| ----------------------- | ------------------ | +| Kubernetes | ✔️ preview release | +| AWS | ✔️ full release | +| GCP | ⚠ Considered | +| Azure | ⚠ Considered | +``` + +_Note for Kuberentes support:_ _Usually the cluster needs to be up and running at all times, as +starting up a cluster is slow._ _Use Google Cloud's Kubernetes Autopilot you can scale down to the +free tier automatically while not in use._ _Kubernetes support currently requires cloud storage, +only S3 support is built-in._ + +```md +| Git Platform | Release Status | +| --------------------- | ------------------ | +| GitHub | ✔️ full release | +| GitLab | ✔️ preview release | +| Command Line | ✔️ preview release | +| Any Git repository | ✔️ preview release | +| Any Git automation/Ci | ✔️ preview release | +``` + +## External Links + +### Cloud Runner Releases + +[Game CI Releases - GitHub](https://github.com/game-ci/unity-builder/releases) _Packaged and +released with game-ci's unity-builder module._ + +### Open Incoming Pull Requests + +[Cloud Runner PRs - GitHub](https://github.com/game-ci/unity-builder/pulls?q=is%3Apr+cloud+runner) + +### 💬Suggestions and 🐛Bugs (GitHub Issues): + +[Game CI Issues - GitHub](https://github.com/game-ci/unity-builder/labels/cloud-runner) + +### Community + +**Share your feedback with us!** + +- [**Discord Channel**](https://discord.com/channels/710946343828455455/789631903157583923) +- [**Feedback Form**](https://forms.gle/3Wg1gGf9FnZ72RiJ9) diff --git a/versioned_docs/version-2/03-github-cloud-runner/02-game-ci-vs-cloud-runner.mdx b/versioned_docs/version-2/03-github-cloud-runner/02-game-ci-vs-cloud-runner.mdx new file mode 100644 index 00000000..1ba9ae94 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/02-game-ci-vs-cloud-runner.mdx @@ -0,0 +1,42 @@ +# Game-CI vs Cloud Runner + +# Standard Game-CI (Use Cases) + +The Game CI core is a maintained set of docker images that can be used to run workloads in many +scenarios. + +Game CI also provides specific GitHub actions for running workflows on GitHub. And a similar +workflow for running Game CI on GitLab and Circle CI. _All of these options use the build server +resources provided by those systems, this can be a constraint or very convenient depending on the +size of your project and the workloads you need to run._ + +# Cloud Runner (Use Cases) + +## Sending Builds to the cloud + +You may want to take advantage of cloud resources for lots of reasons (scale, speed, cost, +flexibility) or may want to start remote builds from the command line without slowing down your +development machine. Cloud Runner can help you do this. + +This may be a preference, more effecient or you may want to use systems that struggle to handle +large game development projects (GitHub being a good example). + +### Large GitHub Projects + +GitHub Actions by default run on +[build machines provided by GitHub](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners). +For Unity projects the available disk size is quite small. You may experience an error related to +running out of disk space. You may also want to run the build on a server with more memory or +processing resources. + +### GitHub Self-Hosted Runners vs Game CI Cloud Runner + +_GitHub users can consider: +[GitHub self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) +and Cloud Runner. Both can enable you to build larger projects._ + +_Cloud Runner is better if you don't have a server setup or don't want to manage or maintain your +own build server._ + +_Self-hosted runners are best used when you already have a server available, running 24/7 that you +can setup as a runner. And you're happy to maintain and keep that server available and running._ diff --git a/versioned_docs/version-2/03-github-cloud-runner/02-getting-started.mdx b/versioned_docs/version-2/03-github-cloud-runner/02-getting-started.mdx new file mode 100644 index 00000000..7e12cfdf --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/02-getting-started.mdx @@ -0,0 +1,3 @@ +# Getting Started + +To get quickly started checkout one of our examples: diff --git a/versioned_docs/version-2/03-github-cloud-runner/03-examples/01-command-line.mdx b/versioned_docs/version-2/03-github-cloud-runner/03-examples/01-command-line.mdx new file mode 100644 index 00000000..cc1afb5e --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/03-examples/01-command-line.mdx @@ -0,0 +1,49 @@ +# Command Line + +_Preview Support Only_ + +You can install Game CI locally and start cloud runner jobs from the command line or by integrating +your own tools. All parameters in [API Reference](../api-reference) can be specified as command line +input fields. + +# Install + +Currently (development) + +```bash +git clone https://github.com/game-ci/unity-builder.git +yarn install +yarn run cli -m {mode parameter} --projectPath {Your project path} {... other command line parameters} +``` + +# Planned (does not work currently) + +We plan to offer support for Game CI via Deno. This will enable fast, typescript native runtime and +you will be able to access this via the following: + +```bash +dpx game-ci build +``` + +# Help + +_You can run `yarn run cli -h` or `yarn run cli --help` to List all modes and paramters with +descriptions_ + +# Main Command Parameters + +- Default: `cli` (runs a standard build workflow) +- See API Reference "Modes" + +# Keeping command line parameters short + +You can avoid specifying long command line input for credentials by using environment variables or +[the input override feature](../advanced-topics/configuration-override#example) to shorten commands +signficantly. + +This enables you to provide a command to pull input, e.g you can pull from a file or from a secret +manager. + +```bash +yarn run cli --populateOverride true --pullInputList UNITY_EMAIL,UNITY_SERIAL,UNITY_PASSWORD --inputPullCommand="gcloud secrets versions access 1 --secret=\"{0}\"" +``` diff --git a/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/02-aws.mdx b/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/02-aws.mdx new file mode 100644 index 00000000..2317f92f --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/02-aws.mdx @@ -0,0 +1,71 @@ +# AWS + +## Requirements + +- You must have an AWS account setup and ready to create resources. +- Create a service account and generate an AWS access key and key id. + +## AWS Credentials + +Setup the following as `env` variables for cloud runner to use: + +- `AWS_ACCESS_KEY_ID` +- `AWS_SECRET_ACCESS_KEY` +- `AWS_DEFAULT_REGION` (should be the same AWS region as the base stack e.g `eu-west-2`) + +If you're using GitHub you can use a GitHub Action: + +```yaml +- name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-2 +``` + +_Note:_ _This enables Cloud Runner access AWS._ + +## Configuration For AWS Cloud Runner Jobs + +Refer to [Configuration page](../../api-reference) or the [example below](#example). + +### Allowed CPU/Memory Combinations + +There are some limitations to the CPU and Memory parameters. AWS will only accept the following +combinations: +[AWS Fargate Documentation, Allowed CPU and memory values (Task Definitions)](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size) + +#### Summary Of Format + +- Values are represented as 1024:1 GB or CPU. +- Do not include the vCPU or GB suffix. +- 1 CPU can go to a max of 6 GB of memory. 2 CPU's are required to go higher. + +#### Valid CPU and Memory Values + +```yaml +- cloudRunnerMemory: 4096 +- cloudRunnerCpu: 1024 +``` + +## Example + +```yaml +- uses: game-ci/unity-builder@cloud-runner-develop + id: aws-fargate-unity-build + with: + providerStrategy: aws + versioning: None + projectPath: `your path here` + unityVersion: `unity version here` + targetPlatform: ${{ matrix.targetPlatform }} + gitPrivateToken: ${{ secrets.GITHUB_TOKEN }} + # You may want to export your builds somewhere external so you can access it: + containerHookFiles: aws-s3-upload-build +``` + +_[Custom Steps](../../advanced-topics/custom-hooks/container-hooks)_ + +A full workflow example can be seen in builder's +[Cloud Runner GitHub sourcecode for GitHub Pipeline](https://github.com/game-ci/unity-builder/blob/309d668d637ae3e7ffe90d61612968db92e1e376/.github/workflows/cloud-runner-pipeline.yml#L109). diff --git a/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/03-kubernetes.mdx b/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/03-kubernetes.mdx new file mode 100644 index 00000000..fe1f4a56 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/03-kubernetes.mdx @@ -0,0 +1,51 @@ +# Kubernetes + +## Requirements + +- You must have a Kuberentes cluster setup and ready that supports persistent volumes. +- Create a kubeconfig and encode it as base64. + +## K8s Credentials + +Setup the following as `env` variables for the GitHub build step: + +- `kubeConfig` (should be encoded as base64) + +## Configuration For Kubernetes Cloud Runner Jobs + +Refer to [Configuration page](../../api-reference) or the [example below](#example). + +### Allowed CPU/Memory Combinations + +- `0.25 vCPU` - 0.5 GB, 1 GB, 2 GB +- `0.5 vCPU` - 1 GB, 2 GB, 3 GB, 4 GB +- `1 vCPU` - 2 GB, 3 GB, 4 GB, 5 GB, 6 GB, 7 GB, 8 GB +- `2 vCPU` - Between 4 GB and 16 GB in 1-GB increments +- `4 vCPU` - Between 8 GB and 30 GB in 1-GB increments + +#### Summary Of Format + +- Values are represented as 1024:1 GB or CPU. + +Do not include the vCPU or GB suffix. + +### Example + +```yaml +- uses: game-ci/unity-builder@cloud-runner-develop + id: k8s-unity-build + with: + providerStrategy: k8s + versioning: None + projectPath: `your path here` + unityVersion: `unity version here` + targetPlatform: ${{ matrix.targetPlatform }} + gitPrivateToken: ${{ secrets.GITHUB_TOKEN }} + # You may want to export your builds somewhere external so you can access it: + containerHookFiles: aws-s3-upload-build +``` + +_[Custom Steps](../../advanced-topics/custom-hooks/container-hooks)_ + +A full workflow example can be seen in builder's +[Cloud Runner GitHub sourcecode for AWS Pipeline](https://github.com/game-ci/unity-builder/blob/main/.github/workflows/cloud-runner-k8s-pipeline.yml). diff --git a/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/_category_.yaml b/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/_category_.yaml new file mode 100644 index 00000000..b9807118 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/03-examples/02-github-examples/_category_.yaml @@ -0,0 +1,5 @@ +--- +position: 2.0 +label: GitHub +collapsible: true +collapsed: true diff --git a/versioned_docs/version-2/03-github-cloud-runner/03-examples/_category_.yaml b/versioned_docs/version-2/03-github-cloud-runner/03-examples/_category_.yaml new file mode 100644 index 00000000..825e328f --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/03-examples/_category_.yaml @@ -0,0 +1,5 @@ +--- +position: 2.0 +label: Examples +collapsible: true +collapsed: true diff --git a/versioned_docs/version-2/03-github-cloud-runner/04-api-reference.mdx b/versioned_docs/version-2/03-github-cloud-runner/04-api-reference.mdx new file mode 100644 index 00000000..67a9ee91 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/04-api-reference.mdx @@ -0,0 +1,221 @@ +# API Reference + +## Configuration + +_You can specify input parameters via any of the following methods._ + +- **GitHub Action `with`** _See "Getting Started" examples._ +- **Command Line** _You can specify input parameters via command line._ +- **Environment Variables** _You can specify input parameters via environment variables._ +- **Configuration Override** _[Advanced Topics / Overrides](advanced-topics/configuration-override)_ + +## Modes + +Cloud Runner can accept a parameter to run a specific mode, by default cli-build is run. + +```bash +cli-build +``` + +_runs a cloud runner build_ + +```bash +list-resources +``` + +_lists active resources_ + +```bash +list-worfklow +``` + +_lists running workflows_ + +```bash +watch +``` + +_follows logs of a running workflow_ + +```bash +garbage-collect +``` + +_runs garbage collection_ + +```bash +- cache-push +- cache-pull +``` + +Cache commands to push and pull from the local caching directory. Used in cloud runner workflows. +Uses `cachePullFrom` and `cachePushTo` parameters. + +```bash +- hash (hash folder contents recursively) +- print-input (prints all input parameters) +``` + +Utility commands + +```bash +- remote-cli-pre-build (sets up a repository, usually before a game-ci build) +- remote-cli-post-build (pushes to LFS and Library cache) +``` + +Commands called during cloud runner workflows before/after a build. + +## Common Parameters + +### Git syncronization parameters + +```bash +gitPrivateToken (should be a GitHub access token with permission to get repositories) +``` + +Used to authenticate remote job's access to repository. + +```bash +- GITHUB_REPOSITORY +- GITHUB_REF || branch || GitSHA +``` + +Used to syncronize the repository to the Cloud Runner job. If parameters are not provided, will +attempt to read them from current directory's git repo (e.g branch, commit SHA, remote URL). + +### Cloud Runner parameters + +```bash +providerStrategy +``` + +Specifies the Cloud Provider to use for Cloud Runner jobs. Accepted values: `aws`, `k8s`, +`local-docker`. + +```bash +- containerCpu +- containerMemory +``` + +Specifies the CPU and Memory resources to be used for cloud containers created by Cloud Runner. +(See: getting started section for more configuration options per provider.) + +```bash +cloudRunnerBranch +``` + +Specifies the release branch of Cloud Runner to use for remote containers. Accepted values: `main` +(default), `cloud-runner-preview` (stable/development), `cloud-runner-develop` (latest/development) + +### Custom commands from files parameters + +```bash +- containerHookFiles +- commandHookFiles +- commandHooks +- postBuildContainerHooks +- preBuildContainerHooks +``` + +Specifies the name of custom hook or step files to include in workflow. (Accepted Format: see +"[container hooks](advanced-topics/custom-hooks/container-hooks) +[command hooks](advanced-topics/custom-hooks/command-hooks)") + +### Custom commands from yaml parameters + +```bash +customJob +``` + +Specifies a custom job to override default build workflow. (Accepted Format: see +"[advanced topics / custom job](advanced-topics/custom-hooks/custom-job)") + +### Configuration Override + +```bash +inputPullCommand +``` + +Read parameter from command line ouput, such as a secret manager. Must include a `{0}` to inject the +name of the parameter to pull. (See: +[Configuration Override](advanced-topics/configuration-override)) + +```bash +pullInputList +``` + +List of parameters to apply with `inputPullCommand`. (See: +[Configuration Override](advanced-topics/configuration-override)) + +### Aws + +```bash +awsStackName +``` + +Name of the persistent shared base stack, used to store artifacts and caching. + +### K8s + +```bash +- kubeVolume +- kubeVolumeSize +- kubeStorageClass +``` + +Override name of persistent volume used, size of volume and storage class used. + +### Caching + +```bash +cacheKey +``` + +Defaults to branch name. Defines the scope for sharing cache entries. + +### Utility + +```bash +- cloudRunnerDebug (Debug logging for Cloud Runner) +- useLargePackages (Any packages in manifest.json containing phrase "LargePackage" will be + redirected to a shared folder for all builds sharing a cache key) +- useSharedBuilder (Use a shared clone of Game-CI, saves some storage space and can be used if + you're using one release branch of Cloud Runner) +- useCompressionStrategy (Use Lz4 compression for cache and build artifacts. Enabled by default) +``` + +### Retained Workspace + +```bash +- maxRetainedWorkspaces +``` + +See: [Advanced Topics / Retained Workspaces](advanced-topics/retained-workspace), enables caching +entire project folder. + +### Garbage Collection + +```bash +- garbageMaxAge +``` + +## Command Line Only Parameters + +```bash +- populateOverride +- cachePushFrom +- cachePushTo +- artifactName +- select +``` + +## Other Environment Variables + +```bash +- USE_IL2CPP (Set to `false`) +``` + +# External Links + +All accepted parameters given here with a description: +[https://github.com/game-ci/unity-builder/blob/cloud-runner-develop/action.yml](https://github.com/game-ci/unity-builder/blob/cloud-runner-develop/action.yml) diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/01-caching.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/01-caching.mdx new file mode 100644 index 00000000..f6fb9645 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/01-caching.mdx @@ -0,0 +1,32 @@ +# Caching + +Cloud Runner supports two main caching modes: + +- Standard Caching +- Retained Workspace + +_You can even mix the two by specifying a "MaxRetainedWorkspaces" parameter. Above the max_ +_concurrent jobs a new job will use standard caching._ + +## Standard Caching + +#### Good For + +- Minimum storage use +- Smaller projects + +#### What is cached between builds + +- LFS files +- Unity Library folder + +## Retained Workspace + +#### Good For + +- Minimum storage use +- Smaller projects + +#### What is cached between builds + +- Entire Project Folder diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/02-retained-workspace.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/02-retained-workspace.mdx new file mode 100644 index 00000000..0e1bfbcd --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/02-retained-workspace.mdx @@ -0,0 +1,8 @@ +# Retained Workspaces + +Caches the entire project folder. This option provides the best responsiveness, but also can consume +lots of storage. + +Using API: `maxRetainedWorkspaces`. You can specify a maximum number of retained workspaces, only +one job can use a retained workspace at one time. Each retained workspace consumes more cloud +storage. diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/03-garbage-collection.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/03-garbage-collection.mdx new file mode 100644 index 00000000..9f409254 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/03-garbage-collection.mdx @@ -0,0 +1,17 @@ +# Garbage Collection + +Cloud Runner creates, manages and destroys cloud workloads you request. Resources have to be +created. + +It is possible a resource doesn't get deleted by cloud runner. + +You can use garbage collection to verify everything has been cleaned up. + +Use the **Mode**: `garbage-collect`. + +You can use the following API parameters: + +- Max Age +- Max Size +- Preview Only +- Filter diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-configuration-override.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-configuration-override.mdx new file mode 100644 index 00000000..94134fc1 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-configuration-override.mdx @@ -0,0 +1,19 @@ +# Configuration Override + +When running any unity workload you must provide valid unity credentials. In addition to any other +credentials this is already quite a lot of input. For this reason, it is common to use the command +line mode with input override (link here). This enables you to provide a command to pull input, with +this approach you can create a file to store credentials or pull from a secret manager. + +## Example + +```bash +game-ci -m cli --populateOverride true --readInputFromOverrideList UNITY_EMAIL,UNITY_SERIAL,UNITY_PASSWORD --readInputOverrideCommand="gcloud secrets versions access 1 --secret=\"{0}\"" +``` + +## Required Parameters + +- `populateOverride` - Must be true to run the commands. +- `readInputFromOverrideList` - Comma separated list of parameters to read from override command. +- `readInputOverrideCommand` - A command line command to run (The command is formatted to replace + "{0}" with the parameter parameter name). diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/01-custom-job.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/01-custom-job.mdx new file mode 100644 index 00000000..ade52d59 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/01-custom-job.mdx @@ -0,0 +1,4 @@ +# Custom Jobs + +You can run a custom job instead of the default build workflow simplfy by specifying the `customJob` +parameter. diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/03-command-hooks.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/03-command-hooks.mdx new file mode 100644 index 00000000..ee1f2378 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/03-command-hooks.mdx @@ -0,0 +1,12 @@ +# Command Hooks + +Custom commands can be injected into the standard build workflow via yaml or files. + +```yaml +- name: example hook + hook: | + step: + - before + commands: | + echo "hello world!" +``` diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/04-container-hooks.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/04-container-hooks.mdx new file mode 100644 index 00000000..6e0a9adc --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/04-container-hooks.mdx @@ -0,0 +1,13 @@ +# Container Hooks + +Custom docker container steps can be run as part of the standard build workflow. Custom steps can +also be run standalone. + +Custom steps can be specified via the CustomSteps parameter or via Custom Step files. + +```yaml +- name: upload + image: amazon/aws-cli + commands: | + echo "hello world!" +``` diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/05-premade-container-jobs.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/05-premade-container-jobs.mdx new file mode 100644 index 00000000..a87c9586 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/05-premade-container-jobs.mdx @@ -0,0 +1,38 @@ +# Premade Container Jobs + +## Cache syncronization + +### Upload Cache entry to AWS S3 + +Upload cache results from build to AWS S3. + +`aws-s3-upload-cache` + +### Download Latest Cache entry from AWS S3 + +Downloads library and git LFS cache from AWS S3. + +`aws-s3-pull-cache` + +## Artifacts + +## Upload Build Artifact To AWS S3 + +`aws-s3-upload-build` + +Upload build artifact to AWS S3. (Currently only supports lz4 enabled which is default.) + +## Upload Project Artifact To AWS S3 (To Do) + +Upload project artifact to AWS S3. (Currently only supports lz4 enabled which is default.) + +## Artifact entire project folder (To Do) + +archive to tar format, compress with lz4 if enabled and store in persistent cache folder. (Can then +upload.) + +## Deploy + +## Upload to Steam (To Do) + +upload build folder to given steam branch diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/_category_.yaml b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/_category_.yaml new file mode 100644 index 00000000..445f7ab4 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/04-custom-hooks/_category_.yaml @@ -0,0 +1,5 @@ +--- +position: 4.0 +label: Custom Hooks +collapsible: true +collapsed: true diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/05-logging.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/05-logging.mdx new file mode 100644 index 00000000..9e4c9492 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/05-logging.mdx @@ -0,0 +1,13 @@ +# Logging + +Logs are streamed from the workload to the Game CI origin unless you use the + +## Kubernetes + +- Native kuberentes logging api + +## AWS + +- Fargate log to Cloud Watch +- Subscription from Cloud Watch to Kinesis +- Game CI streams from logs from Kinesis diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/06-secrets.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/06-secrets.mdx new file mode 100644 index 00000000..e1dd64a9 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/06-secrets.mdx @@ -0,0 +1,14 @@ +# Secrets + +Secrets are transferred to workload containers as secrets via the built-in secrets system the +provider being used supports. + +## Kubernetes + +secrets are created as native kuberentes secret objects and mounted to job containers as env +variables. + +## AWS + +secrets are created as aws secret manager secrets and mounted to fargate tasks from secrets to env +variables. diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/09-gitlab/01-introduction-gitlab.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/09-gitlab/01-introduction-gitlab.mdx new file mode 100644 index 00000000..86b25959 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/09-gitlab/01-introduction-gitlab.mdx @@ -0,0 +1,3 @@ +# GitLab Introduction + +You can use GitLab with Cloud Runner via the Command Line mode. diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/09-gitlab/_category_.yaml b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/09-gitlab/_category_.yaml new file mode 100644 index 00000000..0407bcd5 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/09-gitlab/_category_.yaml @@ -0,0 +1,5 @@ +--- +position: 9.0 +label: GitLab Integration +collapsible: true +collapsed: true diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/10-github/01-github-checks.mdx b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/10-github/01-github-checks.mdx new file mode 100644 index 00000000..94fd90d9 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/10-github/01-github-checks.mdx @@ -0,0 +1,7 @@ +# GitHub Checks + +By enabling the `githubCheck` parameter, the cloud runner job will create a GitHub check for each +step. + +The step will show useful details about the job. This is especially useful in combination with async +mode, as you can run very long jobs. diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/10-github/_category_.yaml b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/10-github/_category_.yaml new file mode 100644 index 00000000..ecbee03f --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/10-github/_category_.yaml @@ -0,0 +1,5 @@ +--- +position: 10.0 +label: GitHub Integration +collapsible: true +collapsed: true diff --git a/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/_category_.yaml b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/_category_.yaml new file mode 100644 index 00000000..da411968 --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/06-advanced-topics/_category_.yaml @@ -0,0 +1,5 @@ +--- +position: 5.0 +label: Advanced topics +collapsible: true +collapsed: true diff --git a/versioned_docs/version-2/03-github-cloud-runner/_category_.yaml b/versioned_docs/version-2/03-github-cloud-runner/_category_.yaml new file mode 100644 index 00000000..cbda169c --- /dev/null +++ b/versioned_docs/version-2/03-github-cloud-runner/_category_.yaml @@ -0,0 +1,5 @@ +--- +position: 3.1 +label: Github (Cloud Runner) +collapsible: true +collapsed: true diff --git a/versioned_docs/version-2/03-github/01-getting-started.mdx b/versioned_docs/version-2/03-github/01-getting-started.mdx new file mode 100644 index 00000000..deee83ba --- /dev/null +++ b/versioned_docs/version-2/03-github/01-getting-started.mdx @@ -0,0 +1,359 @@ +import Video from '../../../src/components/video/video'; + +# Getting started + +GitHub [Actions for Unity](https://github.com/game-ci/unity-actions) provide the fastest and +**easiest** way to automatically test and build any Unity project. + +There are a few parts to setting up a workflow. Steps may slightly differ depending on each license +type. + +## Mental model + +#### Overall steps + +1. Understand how [Github Actions](https://docs.github.com/en/actions) work. +2. Configure a license for Unity. +3. Set up a workflow for your project. +4. Result: Merge pull requests with more confidence. + +#### Setting up a workflow + +Setting up a workflow is easy! + +Create a file called `.github/workflows/main.yml` in your repository and configure the following +steps; + +1. Checkout your repository using [Checkout](https://github.com/marketplace/actions/checkout). +2. Cache Unity Library folder using [Cache](https://github.com/marketplace/actions/cache). +3. Configure your test job using + [Test Runner](https://github.com/marketplace/actions/unity-test-runner). +4. Configure your build job using [Builder](https://github.com/marketplace/actions/unity-builder). +5. Deploy your application. + +_**Note:** all steps will be explained in the next chapters._ + +## Support + +### First time using GitHub Actions? + +Read the official documentation on how to setup a +[workflow](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow). + +Any subsequent steps assume you have read the above. + +### Supported Unity versions + +Unity Actions are using [game-ci/docker](https://github.com/game-ci/docker/) since `unity-builder` +version 2. Any version in this [list](/docs/docker/versions) can be used. + +## Video Tutorial + +