docker yml 修正 #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Golang API Test | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./api | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Build | |
run: go build -v ./... | |
- name: Start docker for test | |
run: docker-compose up -d | |
- name: DBの起動をまって DB を migrate する | |
# migration が成功するまで待つことで、docker の database の起動を待つ | |
uses: nick-invision/retry@v3 | |
with: | |
retry_wait_seconds: 10 # マイグレーションに失敗したら10秒待ってリトライする | |
max_attempts: 3 # 3回失敗したらCI失敗とする | |
timeout_minutes: 1 # 実行に1分以上かかっていたら失敗とする | |
command: go run cmd/main.go migrate | |
- name: Test | |
run: go test -v ./... |