업데이트:

로컬 머신에서 Gitub Actions를 실행할 수 있는 도구

Act

  • https://github.com/nektos/act/
  • .github/workflows/ 에서 GitHub Actions를 읽고 로컬 환경 실행
  • Docker 기반 컨테이너로 운영
    • macOS 에서는 Docker Desktop 필요
  • Linux, MacOS, Windows 지원

설치 및 실행

$ brew install act
  • actions-test/.github/workflows/simple.yml
# This is a basic workflow to help you get started with Actions
name: CI

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      # - uses: actions/checkout@v3

      - name: echo test
        run: |
          cat /etc/*-release
$ git clone https://github.com/cdecl/actions-test
$ cd actions-test 

$ act 
[CI/build] 🚀  Start image=catthehacker/ubuntu:act-latest
[CI/build]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[CI/build]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[CI/build]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[CI/build] ⭐ Run Main echo test
[CI/build]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
| DISTRIB_ID=Ubuntu
| DISTRIB_RELEASE=22.04
| DISTRIB_CODENAME=jammy
| DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
| PRETTY_NAME="Ubuntu 22.04.2 LTS"
| NAME="Ubuntu"
| VERSION_ID="22.04"
| VERSION="22.04.2 LTS (Jammy Jellyfish)"
| VERSION_CODENAME=jammy
| ID=ubuntu
| ID_LIKE=debian
| HOME_URL="https://www.ubuntu.com/"
| SUPPORT_URL="https://help.ubuntu.com/"
| BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
| PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
| UBUNTU_CODENAME=jammy
[CI/build]   ✅  Success - Main echo test
[CI/build] 🏁  Job succeeded
  • Secret 및 Env 적용
VAR1=1111
VAR2=2222
$ act --env-file my.env --secret-file my.secrets

Github Actions 와 모든것이 호환되지는 않음 (e.g. 스케쥴) 테스트 및 개발 용도로 사용 적합

댓글남기기