
github에서 제공하는 자동화된 작업 관리도구
코드를 빌드하거나 테스트하고 배포하는 등의 작업을 자동으로 수행할 수 있게 해준다.
(반복적인 작업을 자동화해서 작업의 효율성을높이고 오류를 줄이는데 크게 도움이 된다.)
자동화된 workflow : github actions에서는 특정 조건(commit, push 등등) 이 충족되면 자동으로 워크플로우가 실행된다.
CI/CD 통합 : 지속적인 통합 (Continuous integration) / 지속적인 배포 (Continuous Deployment) 를 쉽게 구현이 가능하다. 코드가 변경될 때 마다 테스트와 빌드 과정을 자동으로 실행한다.
시간과 인력 오류 감소: 개발자들이 수동으로 해야하는 작업들을 줄여줘서 일관성을 유지하고 작업 효율성이 높아진다.
공식문서에서 제공하는 QuickStart 를 보고 따라해봤다.
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
기본으로 제공하는 github action yml 형식이다.
추가로
간단한 예시
# .github/workflows/test.yml
name: Run Tests
on:
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
쉽고 직관적인 설정 : GitHub 리포지토리에서 바로 설정 가능하며, YAML 파일로 직관적으로 구성
커뮤니티 액션 활용 : GitHub Actions는 다양한 오픈소스 액션을 제공합니다. 예를 들어, 테스트 실행, 배포, 코드 분석 등 다양한 액션을 쉽게 찾아 사용
빠른 피드백 루프 : 코드 변경 시마다 자동으로 작업이 실행되기 때문에, 코드 품질 유지에 유리