@@ -8,10 +8,9 @@ gitlab using gitlab-ci.
8
8
## Overall steps
9
9
10
10
1 . Understand how [ gitlab-ci] ( https://docs.gitlab.com/ce/ci/ ) works.
11
- 2 . Configure a license for Unity.
12
- 3 . Add build scripts and integrations in your Unity project
13
- 4 . Set up a gitlab-ci pipeline for your project.
14
- 5 . Result: Accept merge requests with more confidence.
11
+ 2 . Add build scripts and gitlab-ci integration in your Unity project
12
+ 3 . Configure a license for Unity.
13
+ 4 . Successfully build and test your Unity project 🎉
15
14
16
15
## First time using Gitlab CI?
17
16
@@ -22,55 +21,96 @@ Any subsequent steps assume you have read the above.
22
21
23
22
## Supported versions
24
23
25
- The [ unity3d-gitlab-ci-example project] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/ ) is
26
- based on [ unity3d] ( https://github.com/game-ci/docker/ ) docker images from
27
- [ game-ci] ( https://github.com/game-ci ) . Any version in the
28
- [ docker hub ` unityci/editor ` tags list] ( https://hub.docker.com/r/unityci/editor/tags ) can be used to
29
- test and build projects.
24
+ The [ unity3d-gitlab-ci-example project] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/ ) uses
25
+ [ unity3d docker images] ( https://github.com/game-ci/docker/ ) published by
26
+ [ game-ci] ( https://github.com/game-ci ) .
30
27
31
- It's generally considered good practice to use the same Unity version for your CI/CD setup as you do
32
- to develop your project.
28
+ :::tip
29
+
30
+ Before proceeding, verify that your Unity version is supported by checking the
31
+ [ Docker > Versions page] ( /docs/docker/versions ) .
32
+
33
+ :::
34
+
35
+ It is generally considered good practice to use the same Unity version for your CI/CD setup as you
36
+ do to develop your project. Our Gitlab CI configuration will automatically detect and use the
37
+ correct Unity version for your project.
33
38
34
39
## Video tutorial
35
40
36
41
<Video url = " https://www.youtube-nocookie.com/embed/k0NcedDzEqA" />
37
42
38
- ## Setting up gitlab-ci for your Unity project
43
+ :::caution
44
+
45
+ The video (recorded with Unity 2020.x) is slightly outdated, but the general concepts are still the
46
+ same. 👍
47
+
48
+ - The activation process has changed a bit since then.
49
+ - Docker images have been updated
50
+ - The ` .gitlab-ci.yml ` file uses different variables now.
51
+
52
+ :::
53
+
54
+ ### Steps to Set Up Unity CI/CD with GitLab
55
+
56
+ #### 1. Clone the Example Repository
57
+
58
+ Start by cloning the GameCI example project provided by GameCI to use its configuration files.
59
+
60
+ ``` bash
61
+ git clone https://gitlab.com/game-ci/unity3d-gitlab-ci-example.git
62
+ ```
63
+
64
+ #### 2. (Optional) Checkout a Specific Version
65
+
66
+ If you want to use a specific version of the example project, checkout the desired tag.
67
+
68
+ ``` bash
69
+ cd unity3d-gitlab-ci-example
70
+ git checkout v4.0.0
71
+ cd ..
72
+ ```
73
+
74
+ :::info
75
+
76
+ See [ example project's release] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/releases ) for
77
+ stable versions.
39
78
40
- ### I don't have a Unity project yet
79
+ :::
41
80
42
- 1 . Fork
43
- [ the unity3d-gitlab-ci-example project] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/ )
44
- 1 . Clone the fork you just created locally
45
- 1 . Continue to activation instructions
81
+ #### 3. Navigate to Your Unity Project
46
82
47
- ### I already have my own Unity project
83
+ Replace ` your-unity-project ` with the actual name of your Unity project folder.
48
84
49
- 1 . Clone
50
- [ the unity3d-gitlab-ci-example project] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/ )
51
- 1 . Copy
52
- [ ` .gitlab-ci.yml ` ] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/.gitlab-ci.yml )
53
- to the root of your repository,
54
- [ ` Assets/Scripts/Editor/BuildCommand.cs ` ] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/Assets/Scripts/Editor/BuildCommand.cs )
55
- and [ ` ci ` folder] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/ci ) to your
56
- project:
85
+ ``` bash
86
+ cd your-unity-project
87
+ ```
57
88
58
- Assuming you've cloned the example project in the parent folder of your project, and your Unity
59
- project is at the root of your repository, execute these commands from the root folder of your
60
- project:
89
+ #### 4. Create Necessary Directories
90
+
91
+ Create the required directories in your Unity project to hold CI-related files.
61
92
62
93
``` bash
63
94
mkdir -p Assets/Scripts/Editor/
95
+ ```
96
+
97
+ #### 5. Copy Required Files
98
+
99
+ Copy the necessary CI configuration and scripts from the example project to your Unity project.
100
+
101
+ ``` bash
64
102
cp ../unity3d-gitlab-ci-example/.gitlab-ci.yml ./
65
103
cp -r ../unity3d-gitlab-ci-example/ci ./
66
104
cp ../unity3d-gitlab-ci-example/Assets/Scripts/Editor/BuildCommand.cs ./Assets/Scripts/Editor/
67
105
```
68
106
69
- 1 . Open and edit the
70
- [ ` .gitlab-ci.yml ` ] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/.gitlab-ci.yml )
71
- you copied to your project and update
72
- [ the variables] ( https://gitlab.com/game-ci/unity3d-gitlab-ci-example/-/blob/main/.gitlab-ci.yml#L7-13 )
73
- with the versions you need. Your Unity project version can be found in
74
- ` ProjectSettings/ProjectVersion.txt ` .
75
- 1 . If your Unity project is not at the root of your repository, also update UNITY_DIR variable.
76
- 1 . Continue to activation instructions
107
+ #### Final Note:
108
+
109
+ If your Unity project is not at the root of your repository, update the paths accordingly in the
110
+ commands above and in the ` .gitlab-ci.yml ` file. Adjust the ` UNITY_DIR ` variable in ` .gitlab-ci.yml `
111
+ to point to your project directory.
112
+
113
+ ## Proceed to activation
114
+
115
+ That’s It! You're one step away from having automated builds and tests for your Unity project.
116
+ Proceed to the [ Activation] ( ./02-activation.mdx ) guide.
0 commit comments