[Open source tools] How to configure Jenkins to pull Git/Jenkins and use Unity for one-click packaging [windows][android]
-
- 1. Background introduction
- 2.Jenkins installation & use
- 3.Jenkins pulls Git
- 4. Jenkins configures Unity packaging (direct command line, without the unity3d plug-in)
- 5. [Recommended] Use the Unity3d plug-in package that comes with Jenkins to output complete logs
- 6.TODO pull Git+Unity package and merge processing, to be continued
1. Background introduction
1.1What is Jenkins?
Jenkins official website is an open source CI&CD (continuous integration & continuous deployment) software used to automate various tasks, including building, testing and deploying software.
Easy installation: Jenkins is a standalone Java-based program that runs out of the box on Windows, Mac OS X, and other Unix-like operating systems. Jenkins supports various running methods, either through system packages, Docker or through a standalone Java program.
Plug-in extensions: With more than 1,000 plug-ins in the update center, Jenkins integrates almost all tools in the continuous integration and continuous delivery tool chain. And Jenkins is extensible through its plug-in architecture, providing nearly unlimited possibilities for what Jenkins can do.
Distributed: Jenkins can easily distribute work across multiple machines, helping drive builds, tests, and deployments across multiple platforms faster.
CI&CD: As a scalable automation server, Jenkins can be used as a simple CI server or turned into a continuous delivery hub for any project.
1.2 What are the benefits of using Jenkins+Unity?
In layman's terms, it means that the repetitive packaging work is handed over to the computer, freeing the programmer, and the program can directly look at the packaging results.
2.Jenkins installation & use
The windows environment + tomcat deployment I use
2.1Java11
2.2 Download jenkins.war (I use tomcat so I need it, you can use jenkins to install the version)
2.3 Using Tomcat9
Download Tomcat9
and extract it to the path:
2.4 After decompressing tomcat9, put jenkins.war into
2.5 Double-click to run startup.bat -> include jenkins
Solving the Chinese garbled
tomcat9 with jenkins will have the initial password of jenkins
2.6 Copy the text and visit localhost:8080/jenkins
3.Jenkins pulls Git
4. Jenkins configures Unity packaging (direct command line, without the unity3d plug-in)
4.1 github project-jenkins_unity
4.2windows-bat packaging…
4.3 Core packaging.cs
using System;
using UnityEditor;
class MyEditorScript {
[MenuItem ("Custom/CI/Build Android")]
public static void BuildAndroid()
{
string[] scenes = { "Assets/Scenes/SampleScene.unity"}; // 填写您的场景文件路径
string outputPath = "Builds/Android/JenkinsUnity.apk";
BuildPipeline.BuildPlayer(scenes, outputPath, BuildTarget.Android, BuildOptions.None);
}
}
5. [Recommended] Use the Unity3d plug-in package that comes with Jenkins to output complete logs
Here is a reference to my friend TopGames’ blog
Add parameters: ProjectRoot
and then configure the built-in unity3d plug-in in Jenkins.
After installing the unity3d plug-in,
open the global tool configuration as shown in the figure
. Now return to the project configuration:
Copy the following content:
Click to run:
the console will print the complete unity log.