refactor: consolidate extraction safety, share yapdb tail, split mega… #522
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: 🔄 Continuous Integration | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths-ignore: | |
| - "docs/**" | |
| - "*.md" | |
| - ".gitignore" | |
| pull_request: | |
| branches: ["main"] | |
| paths-ignore: | |
| - "docs/**" | |
| - "*.md" | |
| - ".gitignore" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GO_VERSION: "1.26.4" | |
| jobs: | |
| # =================================== | |
| # Code Quality & Linting | |
| # =================================== | |
| quality: | |
| name: 🔍 Code Quality | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: 📂 Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🐹 Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: 📥 Download dependencies | |
| run: go mod download | |
| - name: 🧹 Run gofmt | |
| run: | | |
| if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | |
| echo "❌ Code is not formatted:" | |
| gofmt -s -l . | |
| exit 1 | |
| fi | |
| echo "✅ Code is properly formatted" | |
| - name: 🔍 Run go vet | |
| run: go vet ./... | |
| - name: 📊 Run golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: latest | |
| - name: 📝 Run markdownlint | |
| uses: DavidAnson/markdownlint-cli2-action@v23 | |
| with: | |
| globs: "**/*.md" | |
| # =================================== | |
| # Security Scanning | |
| # =================================== | |
| security: | |
| name: 🔒 Security Scan | |
| uses: ./.github/workflows/_reusable-security-scan.yml | |
| with: | |
| go-version: "1.26.4" | |
| upload-sarif: true | |
| run-vulncheck: false | |
| # =================================== | |
| # Build & Test Matrix | |
| # =================================== | |
| test: | |
| name: 🧪 Test | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| # os: [ubuntu-latest, macos-latest, windows-latest] | |
| go-version: ["1.26.4"] | |
| steps: | |
| - name: 📂 Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🐹 Set up Go ${{ matrix.go-version }} | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| cache: true | |
| - name: 📥 Download dependencies | |
| run: go mod download | |
| - name: ✅ Verify dependencies | |
| run: go mod verify | |
| - name: 🔨 Build project | |
| run: CGO_ENABLED=0 go build -v ./... | |
| - name: 🧪 Run tests | |
| run: go test -p 1 -v ./... | |
| # =================================== | |
| # Build Validation | |
| # =================================== | |
| build: | |
| name: 🔨 Build Validation | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: [quality, security] | |
| steps: | |
| - name: 📂 Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🐹 Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: 📥 Download dependencies | |
| run: go mod download | |
| - name: 🔨 Build for multiple architectures | |
| run: | | |
| # Linux | |
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o dist/yap-linux-amd64 ./cmd/yap | |
| CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o dist/yap-linux-arm64 ./cmd/yap | |
| # # macOS | |
| # CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o dist/yap-darwin-amd64 ./cmd/yap | |
| # CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o dist/yap-darwin-arm64 ./cmd/yap | |
| # # Windows | |
| # CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o dist/yap-windows-amd64.exe ./cmd/yap | |
| echo "✅ Multi-architecture build successful" | |
| - name: 🧪 Test built binaries | |
| run: | | |
| ./dist/yap-linux-amd64 version | |
| echo "✅ Binary execution test passed" | |
| - name: 📦 Upload build artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: build-artifacts | |
| path: dist/ | |
| retention-days: 7 | |
| # =================================== | |
| # Integration Tests | |
| # =================================== | |
| integration: | |
| name: 🔗 Integration Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [build] | |
| if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
| continue-on-error: true # Integration tests require Docker/container runtime; may fail in CI environment | |
| services: | |
| docker: | |
| image: docker:dind | |
| options: --privileged | |
| steps: | |
| - name: 📂 Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🐹 Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: 🐳 Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: 📥 Download build artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: build-artifacts | |
| path: dist/ | |
| - name: 🔧 Make binaries executable | |
| run: chmod +x dist/* | |
| - name: 🧪 Run integration tests | |
| run: | | |
| # Test example PKGBUILD if available | |
| if [ -f examples/yap/PKGBUILD ]; then | |
| echo "🧪 Testing example build..." | |
| cd examples/yap | |
| timeout 300 ../../dist/yap-linux-amd64 build --skip-sync . | |
| cd ../.. | |
| fi | |
| # =================================== | |
| # Documentation Generation | |
| # =================================== | |
| docs: | |
| name: 📚 Documentation | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: 📂 Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🐹 Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: 📚 Generate documentation | |
| run: | | |
| make doc-deps | |
| make doc-generate | |
| - name: 📤 Upload documentation artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: documentation | |
| path: docs/api/ | |
| retention-days: 30 | |
| # =================================== | |
| # Summary Job | |
| # =================================== | |
| ci-success: | |
| name: ✅ CI Success | |
| runs-on: ubuntu-latest | |
| needs: [quality, security, test, build, integration, docs] | |
| if: always() | |
| steps: | |
| - name: 🎉 All jobs completed | |
| run: | | |
| if [[ "${{ needs.quality.result }}" == "success" && \ | |
| "${{ needs.security.result }}" == "success" && \ | |
| "${{ needs.test.result }}" == "success" && \ | |
| "${{ needs.build.result }}" == "success" && \ | |
| ("${{ needs.integration.result }}" == "success" || "${{ needs.integration.result }}" == "skipped") && \ | |
| ("${{ needs.docs.result }}" == "success" || "${{ needs.docs.result }}" == "skipped") ]]; then | |
| echo "🎉 All CI jobs completed successfully!" | |
| exit 0 | |
| else | |
| echo "❌ Some CI jobs failed" | |
| exit 1 | |
| fi |