ci: GitHub Actions による CI ワークフローを追加 #2
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # 同一ブランチで新しい push があれば実行中のジョブをキャンセルする | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup tools (mise) | |
| uses: jdx/mise-action@v2 | |
| with: | |
| # 最新版は資産未公開で 404 になることがあるため明示的にピン留めする | |
| version: 2026.6.6 | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run unit tests | |
| run: go test ./... | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup tools (mise) | |
| uses: jdx/mise-action@v2 | |
| with: | |
| # 最新版は資産未公開で 404 になることがあるため明示的にピン留めする | |
| version: 2026.6.6 | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Build all binaries | |
| run: mise run build | |
| vet: | |
| name: Vet & Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup tools (mise) | |
| uses: jdx/mise-action@v2 | |
| with: | |
| # 最新版は資産未公開で 404 になることがあるため明示的にピン留めする | |
| version: 2026.6.6 | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: gofmt | |
| run: | | |
| unformatted="$(gofmt -l .)" | |
| if [ -n "$unformatted" ]; then | |
| echo "::error::以下のファイルが gofmt されていません:" | |
| echo "$unformatted" | |
| exit 1 | |
| fi | |
| - name: go vet | |
| run: go vet ./... |