feat: AI設定とテストファイルの追加 #12
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 ] | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| go-version: ['1.21', '1.22'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| cache: true | |
| - name: Cache Go modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.out ./... | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.out | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| cache: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v3 | |
| with: | |
| version: latest | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [test, lint] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| cache: true | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Build for multiple platforms | |
| run: | | |
| mkdir -p dist | |
| # Linux AMD64 | |
| GOOS=linux GOARCH=amd64 go build -o dist/kidspos-linux-amd64 ./cmd/server | |
| # Linux ARM64 (for newer Raspberry Pi) | |
| GOOS=linux GOARCH=arm64 go build -o dist/kidspos-linux-arm64 ./cmd/server | |
| # Linux ARMv7 (for Raspberry Pi 3) | |
| GOOS=linux GOARCH=arm GOARM=7 go build -o dist/kidspos-linux-armv7 ./cmd/server | |
| # macOS AMD64 | |
| GOOS=darwin GOARCH=amd64 go build -o dist/kidspos-darwin-amd64 ./cmd/server | |
| # macOS ARM64 (Apple Silicon) | |
| GOOS=darwin GOARCH=arm64 go build -o dist/kidspos-darwin-arm64 ./cmd/server | |
| # Windows AMD64 | |
| GOOS=windows GOARCH=amd64 go build -o dist/kidspos-windows-amd64.exe ./cmd/server | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: binaries | |
| path: dist/ | |
| docker: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| needs: [test, lint] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| push: false | |
| tags: kidspos-go:latest | |
| benchmark: | |
| name: Benchmark | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| cache: true | |
| - name: Run benchmarks | |
| run: go test -bench=. -benchmem ./... | |
| vrt: | |
| name: Visual Regression Testing | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| cache: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install Playwright Dependencies | |
| working-directory: ./e2e | |
| run: | | |
| npm ci | |
| npx playwright install --with-deps | |
| - name: Build and Start Server | |
| run: | | |
| go build -o server ./cmd/server | |
| ./server & | |
| sleep 5 | |
| - name: Run VRT Tests | |
| working-directory: ./e2e | |
| run: npm run test:vrt | |
| - name: Upload VRT Results | |
| uses: actions/upload-artifact@v3 | |
| if: failure() | |
| with: | |
| name: vrt-results | |
| path: | | |
| e2e/test-results/ | |
| e2e/playwright-report/ | |
| e2e: | |
| name: End-to-End Tests | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| cache: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install Playwright Dependencies | |
| working-directory: ./e2e | |
| run: | | |
| npm ci | |
| npx playwright install --with-deps | |
| - name: Build and Start Server | |
| run: | | |
| go build -o server ./cmd/server | |
| ./server & | |
| sleep 5 | |
| - name: Run E2E Tests | |
| working-directory: ./e2e | |
| run: npm test | |
| - name: Upload E2E Results | |
| uses: actions/upload-artifact@v3 | |
| if: failure() | |
| with: | |
| name: e2e-results | |
| path: | | |
| e2e/test-results/ | |
| e2e/playwright-report/ |