Merge feat/v2.0: Complete v2.0 architecture refactoring #11
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
| # File: .github/workflows/ci.yml | |
| # Purpose: Continuous Integration workflow - runs tests and linting on every push/PR | |
| # Problem: Need automated testing to catch issues before merge | |
| # Role: CI pipeline for quality assurance | |
| # Usage: Triggered on push to any branch and on pull requests | |
| # Design choices: Runs tests, linting, and build validation; caches Go modules | |
| # Assumptions: Go 1.21+ available; GitHub Actions runner | |
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'feat/**' | |
| - 'fix/**' | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| cache: true | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: | | |
| go test -v -race -coverprofile=coverage.out ./... | |
| - name: Generate coverage report | |
| run: | | |
| go tool cover -func=coverage.out | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./coverage.out | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| lint: | |
| name: Lint | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up 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 | |
| args: --timeout=5m | |
| build: | |
| name: Build | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| cache: true | |
| - name: Build for all architectures | |
| run: | | |
| make build-all | |
| - name: Verify binaries | |
| run: | | |
| file devsetup-darwin-arm64 | |
| file devsetup-darwin-amd64 | |
| ./devsetup-darwin-$(uname -m) --version | |
| validate-configs: | |
| name: Validate Configurations | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Validate YAML configs | |
| run: | | |
| # Install yq for YAML validation | |
| brew install yq | |
| # Validate new config files | |
| echo "Validating configs/tools.yaml..." | |
| yq eval '.' configs/tools.yaml > /dev/null || exit 1 | |
| echo "✅ tools.yaml is valid YAML" | |
| echo "Validating configs/setup.yaml..." | |
| yq eval '.' configs/setup.yaml > /dev/null || exit 1 | |
| echo "✅ setup.yaml is valid YAML" | |
| - name: Verify git submodules | |
| run: | | |
| echo "Checking git submodules..." | |
| git submodule status | |
| # Verify submodules are initialized | |
| if [ -z "$(git submodule status)" ]; then | |
| echo "❌ No submodules found" | |
| exit 1 | |
| fi | |
| echo "✅ Git submodules initialized" | |
| - name: Verify embedded configs | |
| run: | | |
| echo "Verifying configs can be embedded..." | |
| if [ ! -f configs/embed.go ]; then | |
| echo "❌ configs/embed.go not found" | |
| exit 1 | |
| fi | |
| echo "✅ configs/embed.go exists" |