Github Actions
#Github #CI/CD
GithubのCI/CDサービス
https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners#about-virtual-environments
GitHub hosts Linux and Windows runners on Standard_DS2_v2 virtual machines in Microsoft Azure with the GitHub Actions runner application installed. The GitHub-hosted runner application is a fork of the Azure Pipelines Agent. Inbound ICMP packets are blocked for all Azure virtual machines, so ping or traceroute commands might not work. For more information about the Standard_DS2_v2 machine resources, see "Dv2 and DSv2-series" in the Microsoft Azure documentation.
Azure上のVM上で実行。
GitHub Actions runnerは Azure Pipelines Agentからフォークしたもの。
Azureを使っているような感じか。
ワークフローsyntax
https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
複雑なワークフローの管理
https://docs.github.com/ja/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows
設定をyamlで記述
.github/workflows以下に複数の設定ファイル
ワークフロー
slack通知
イベント
ジョブ
runs-onブロック
実行仮想環境の設定
strategy
matrix
パラメーターを組み合わせて、繰り返し実行
複数のnodeバージョンで実行するなど
node-versionがパラメーター名であれば、matrix.node-versionで参照
stepsブロック
ランナー
アーティファクト
https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#artifacts
Storing workflow data as artifacts
https://docs.github.com/en/free-pro-team@latest/actions/guides/storing-workflow-data-as-artifacts
90間保持できる
Log files and core dumps
Test results, failures, and screenshots
Binary or compressed files
Stress test performance output and code coverage results
labeler.yaml
stale.yaml
ワークフローの定期的実行
古くなったissueやプルリクエストを定期的に閉じるなど
-------------
環境ごとにワークフローを分ける。
https://code-log.hatenablog.com/entry/2020/02/07/201830
キャッシュ
owasp-zap
https://github.com/marketplace/actions/owasp-zap-baseline-scan
設定
イベント
pull_request
https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request
デフォルトtypeは、opened, synchronize
push
typeの設定はない?
https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push
設定方針
pull_requestにはpushも入れる?
他参考
https://tech.jxpress.net/entry/gitops-for-terraform-with-github-self-hosted-runner
イベント
code:yml
on:
workflow_dispatch:
手動デプロイ