facebook twitter hatena line email

「Git/github/actions」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(github-actionの種類の設定方法)
(github-actionの種類の設定方法)
行57: 行57:
 
jobs:
 
jobs:
 
   build:
 
   build:
     runs-on: [self-hosted, mac, ARM64]
+
     runs-on: self-hosted
 
</pre>
 
</pre>
  

2021年3月10日 (水) 17:10時点における版

github_actionとは

pull_requestやpushしたときに、実行する処理

利用できるプラン

利用時間(分)

GitHub Free	500 MB	2,000
GitHub Pro	1 GB	3,000
Organization の GitHub Free	500 MB	2,000
GitHub Team	2 GB	3,000
GitHub Enterprise Cloud	50 GB	50,000

公式:https://docs.github.com/ja/github/setting-up-and-managing-billing-and-payments-on-github/about-billing-for-github-actions#

action種類

  • githubホスティング
  • self-hosted runner

self-hosted runnerはローカル端末で動作させるもの

self-hosted runnerで動作

downloadとinstall

Download

# Create a folder
$ mkdir actions-runner && cd actions-runner # Download the latest runner package
$ curl -O -L https://github.com/actions/runner/releases/download/v2.277.1/actions-runner-osx-x64-2.277.1.tar.gz # Extract the installer
$ tar xzf ./actions-runner-osx-x64-2.277.1.tar.gz

Configure

# Create the runner and start the configuration experience
$ ./config.sh --url https://github.com/[user1]/helloworld --token [tokenxxxxxxxxxxxxxxxxxxxxxxxxxxx] # Last step, run it!
$ ./run.sh

[user]と[token]は適宜変更する

有効無効

githubのプロジェクトのsettingsからactionsを選択し、有効無効を選択。

公式参考:https://docs.github.com/ja/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository

設定ファイル

.github/workflows/hogehoge.yml


github-actionの種類の設定方法

hostingの場合(ubuntu-latest)

jobs:
  build:
    runs-on: ubuntu-latest

self-hostedの場合(mac)

jobs:
  build:
    runs-on: self-hosted

タイムアウト設定

timeout-minutesで設定できる。

jobs:
  my-job:
    runs-on: ubuntu-latest
    timeout-minutes: 120 # 全体
    steps:
      - run: sleep 500
        timeout-minutes: 80 # 個別

参考:https://dev.classmethod.jp/articles/must-set-timeout-on-actions-for-save-cost/

WIPのときに実行しないように

参考:https://qiita.com/hkusu/items/10ac4e3579b921f68b6a

参考:https://qiita.com/HeRo/items/935d5e268208d411ab5a