GHA(GitHub Actions) を試す
-
全般のドキュメント
-
.github/workflows ディレクトリを作成、それ以下に、.yml ファイルで定義した Actions を配置していく
-
2つの変数
- 違いは、ここを参照
- ワークフロー内の環境変数
- .yml で定義して、その場でつかう
name: Greeting on variable day
on:
workflow_dispatch
env:
DAY_OF_WEEK: Monday
jobs:
greeting_job:
runs-on: ubuntu-latest
env:
Greeting: Hello
steps:
- name: "Say Hello Mona it's Monday"
run: echo "$Greeting $First_Name. Today is $DAY_OF_WEEK!"
env:
First_Name: Mona
-
構成変数はブラウザ上で設定できる
-
ここで設定
-
env で参照
- env.DAY_OF_WEEK
-
ここに書いてある
-
-
Go でテストしてビルドする
- push してテストを回して、テストの結果とともに Github 上に残すことができる
- 便利そう!
- 参考
name: Go
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.x'
- name: Install dependencies
run: go get .
- name: Build
run: go build -v ./...
- name: Test with the Go CLI
run: go test