Unity

Unity Git hub Actions - 1 (개념 정리)

CCS_Cheese 2025. 2. 25. 20:49

Events

시작하게 된 계기

여러 프로젝트들을 진행하면서, github를 통해 소스를 관리하고 개발하면서, 나의 PC에서 빌드 작업을 진행함에 있어 그 시간 동안 별도의 작업을 하지 못하는 일이 빈번하고, 빌드 시간도 많이 소요되어 이를 해결할 수 있는 방법이 있을까?라는 생각에서 시작하게 되었습니다.
자연스럽게 CI/CD라는 것에 접하게 되었고 이는 무엇인지에 대해 고민하게 되었습니다.

 

CI (Continous Integration) : 지속적인 통합

  • 개발자들의 변경한 기능 혹은 소스코드의 지속적인 통합 -> 팀 단위에서 각자 맡은 부분에 대한 작업물을 공유 저장소에 통합하는 과정

CD (Continous Deployment) : 지속적인 배포

  • 위에서 변경된 사항들에 대한 테스트 및 제품 배포를 지속적으로 확인할 수 있도록 배포 및 빌드하는 모든 것.

간단한 게 정리하자면 위와 같이 정리할 수 있을 것 같습니다.

 

그렇다면, Unity Project에서는 어떻게 할 수 있을까? 

Jenkins, Github를 많이들 활용하는데 이번에는 Github의 Actions 기능을 활용하여 작업해보려고 합니다. 

 

Github Action에 대해 먼저 정리를 해봐야 될 거 같아 정리를 해보게 되었습니다.

github에서 공식적으로 제공하는 CI/CD를 지원하는 툴로 소프트웨어 개발의 WorkFlow를 자동화해 주는 툴입니다.

 

GitHub Actions의 구성요소

  • Workflow
  • Events
  • Jobs
  • Actions
  • Runners
  • Next stepsn

Workflow에 대한 설명 

  • Workflow 사전적 의미 : 업무 절차
A workflow is a configurable automated process that will run one or more jobs. Workflows are defined by a YAML file checked in to your repository and will run when triggered by an event in your repository, or they can be triggered manually, or at a defined schedule.
Workflows are defined in the. github/workflows directory in a repository. A repository can have multiple workflows, each of which can perform a different set of tasks such as:
  • 요약하자면 아래와 같다.
    • 하나 or 2개 이상의 작업 프로세스를 자동화할 수 있게 구성할 수 있다.
    • YAML파일로 구성되며, repository 이벤트에 맞춰서 트리거 된다.
    • 또는 정해진 일정에 맞춰서 트리거 된다.
    • 정해진 경로. github/workflows 에 정의된다.
    • n개의 workflow를 정의할 수 있고 정해진 task에 맞게 수행될 수 있다.

Events

  • Events 사전적 의미 : 일어난 일 or 사건
An event is a specific activity in a repository that triggers a workflow run. For example, an activity can originate from GitHub when someone creates a pull request, opens an issue, or pushes a commit to a repository. You can also trigger a workflow to run on a schedule, by posting to a REST API, or manually.
  • 요약하자면 아래와 같다.
    •  일정이나 수동으로 REST API 게시를 통해 이벤트를 발생시킬 수 있다.
    • 이 활동(workflow)은 push commits, new issue, create PR로 인해 이벤트가 발생할 수 있다.
    • workflows 트리거의 구체적인 활동이다.

Jobs

  • Jobs 사전적 의미 : 작업 or 일 
A job is a set of steps in a workflow that is executed on the same runner. Each step is either a shell script that will be executed, or an action that will be run. Steps are executed in order and are dependent on each other. Since each step is executed on the same runner, you can share data from one step to another. For example, you can have a step that builds your application followed by a step that tests the application that was built.
You can configure a job's dependencies with other jobs; by default, jobs have no dependencies and run in parallel. When a job takes a dependency on another job, it waits for the dependent job to complete before running.
For example, you might configure multiple build jobs for different architectures without any job dependencies and a packaging job that depends on those builds. The build jobs run in parallel, and once they complete successfully, the packaging job runs.
  • 같은 runner 내에서 동작하는 워크플로우안의 step으로 정의된 것을 의미합니다.
  • 각각의 step은 실행되기 위한 shell script 중 하나입니다.
  • jobs는 dependencies를 안 가질 수 있고, 각 run(동작)은 병렬로 처리됩니다.
  • 다른 job을 의존하는 경우 해당 job이 완료될 때까지 기다립니다.

 

Actions

  • Actions의 사전적 의미 : 행위, 행동, 동작
An action is a custom application for the GitHub Actions platform that performs a complex but frequently repeated task. Use an action to help reduce the amount of repetitive code that you write in your workflow files. An action can pull your Git repository from GitHub, set up the correct toolchain for your build environment, or set up the authentication to your cloud provider.
You can write your own actions, or you can find actions to use in your workflows in the GitHub Marketplace.
  • 깃허브를 이용하며, 복잡하지만, 반복적인 작업을 해야 되는 애플리케이션에서 사용하는 것입니다.
  • workflow files의 반복적인 코드 작성을 줄여주는 도움을 준다.
  • github로부터 repository에 pull 할 수 있다.
  • 빌드 환경에 알맞은 toolchain을 세팅할 수 있다.
  • cloud 인증 접근도 도움을 준다.
  • 사전에 미리 정의된 actions 들을 github marketplace에서 많이 확인이 가능하다. 

Github Marketplace

 

 

 

GithubActions

 

Understanding GitHub Actions - GitHub Docs

GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository, or deploy merged

docs.github.com

 

다음 시간에는 간단한 workflow를 만들어보고, actions을 실행해 보는 과정까지 작업해보려고 합니다.