ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

act github actions 本地运行试用

2022-05-15 02:01:12  阅读:226  来源: 互联网

标签:github container string -- actions default act event


安装

使用mac 系统安装

brew install  act

创建项目

  • 项目结构
├── .github
│   └── workflows
│       └── app.yaml
├── package.json
├── src
│   └── app.ts
├── tsconfig.json
└── yarn.lock

app.yaml 定义

name: CI
on: push
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
    - run: npm install
    - run: npm run build
  • 运行

注意因为默认使用的是github 自己的镜像服务,ghcr.io所以会很慢。。。。

 

 

  • act 支持的命令
 
Run GitHub actions locally by specifying the event name (e.g. `push`) or an action name directly.
 
Usage:
  act [event name to run]
If no event name passed, will default to "on: push" [flags]
 
Flags:
  -a, --actor string                     user that triggered the event (default "nektos/act")
      --artifact-server-path string      Defines the path where the artifact server stores uploads and retrieves downloads from. If not specified the artifact server will not start.
      --artifact-server-port string      Defines the port where the artifact server listens (will only bind to localhost). (default "34567")
  -b, --bind                             bind working directory to container, rather than copy
      --bug-report                       Display system information for bug report
      --container-architecture string    Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms.
      --container-cap-add stringArray    kernel capabilities to add to the workflow containers (e.g. --container-cap-add SYS_PTRACE)
      --container-cap-drop stringArray   kernel capabilities to remove from the workflow containers (e.g. --container-cap-drop SYS_PTRACE)
      --container-daemon-socket string   Path to Docker daemon socket which will be mounted to containers (default "/var/run/docker.sock")
      --defaultbranch string             the name of the main branch
      --detect-event                     Use first event type from workflow as event that triggered the workflow
  -C, --directory string                 working directory (default ".")
  -n, --dryrun                           dryrun mode
      --env stringArray                  env to make available to actions with optional value (e.g. --env myenv=foo or --env myenv)
      --env-file string                  environment file to read and use as env in the containers (default ".env")
  -e, --eventpath string                 path to event JSON file
      --github-instance string           GitHub instance to use. Don't use this if you are not using GitHub Enterprise Server. (default "github.com")
  -g, --graph                            draw workflows
  -h, --help                             help for act
      --insecure-secrets                 NOT RECOMMENDED! Doesn't hide secrets while printing logs.
  -j, --job string                       run job
      --json                             Output logs in json format
  -l, --list                             list workflows
      --no-recurse                       Flag to disable running workflows from subdirectories of specified path in '--workflows'/'-W' flag
      --no-skip-checkout                 Do not skip actions/checkout
  -P, --platform stringArray             custom image to use per platform (e.g. -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04)
      --privileged                       use privileged mode
  -p, --pull                             pull docker image(s) even if already present
  -q, --quiet                            disable logging of output from steps
      --rebuild                          rebuild local action docker image(s) even if already present
  -r, --reuse                            don't remove container(s) on successfully completed workflow(s) to maintain state between runs
      --rm                               automatically remove container(s)/volume(s) after a workflow(s) failure
  -s, --secret stringArray               secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret)
      --secret-file string               file with list of secrets to read from (e.g. --secret-file .secrets) (default ".secrets")
      --use-gitignore                    Controls whether paths specified in .gitignore should be copied into container (default true)
      --userns string                    user namespace to use
  -v, --verbose                          verbose output
      --version                          version for act
  -w, --watch                            watch the contents of the local repo and run when files change
  -W, --workflows string                 path to workflow file(s) (default "./.github/workflows/")

说明

act 提供的命令以及功能还是很全的,很方便的工具,值得使用

参考资料

https://github.com/nektos/act

标签:github,container,string,--,actions,default,act,event
来源: https://www.cnblogs.com/rongfengliang/p/16272131.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有