Merge pull request #63 from oaswrap/feat/logger #253
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
| # .github/workflows/ci.yml | |
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CACHE_VERSION: v1 # Increment to bust cache when needed | |
| jobs: | |
| # ======================================== | |
| # Quality Gate | |
| # ======================================== | |
| quality: | |
| name: 🛡️ Quality Gate / ${{ matrix.module }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| module: | |
| - . | |
| - adapter/chiopenapi | |
| - adapter/echoopenapi | |
| - adapter/echov5openapi | |
| - adapter/fiberopenapi | |
| - adapter/fiberv3openapi | |
| - adapter/ginopenapi | |
| - adapter/httpopenapi | |
| - adapter/irisopenapi | |
| - adapter/muxopenapi | |
| steps: | |
| - name: 📥 Checkout | |
| uses: actions/checkout@v4 | |
| - name: 🐹 Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25.x' | |
| check-latest: true | |
| cache: true | |
| - name: ✅ Sync & Tidy | |
| run: make sync tidy | |
| - name: 🔍 Lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.12.2 | |
| working-directory: ${{ matrix.module }} | |
| # ======================================== | |
| # Test Matrix | |
| # ======================================== | |
| test: | |
| name: 🧪 Test Matrix | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 15 | |
| needs: quality | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| go-version: ['1.23', '1.24', '1.25'] | |
| steps: | |
| - name: 📥 Checkout | |
| uses: actions/checkout@v4 | |
| - name: 🐹 Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| check-latest: true | |
| cache: true # Handles module/build cache | |
| - name: 🧪 Run Tests | |
| if: matrix.go-version != '1.25' | |
| run: make test | |
| - name: 📊 Run Tests With Coverage | |
| if: matrix.go-version == '1.25' | |
| run: make testcov | |
| - name: 📈 Upload Coverage Report | |
| if: matrix.go-version == '1.25' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage/coverage.out | |
| fail_ci_if_error: false | |
| verbose: true | |
| # ======================================== | |
| # Security Scan | |
| # ======================================== | |
| security: | |
| name: 🔐 Security Scan | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: quality | |
| env: | |
| GO111MODULE: on | |
| steps: | |
| - name: 📥 Checkout | |
| uses: actions/checkout@v4 | |
| - name: 🐹 Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25.x' | |
| check-latest: true | |
| cache: true | |
| - name: Run Gosec Security Scanner | |
| uses: securego/gosec@v2.26.1 | |
| with: | |
| args: '-no-fail -fmt sarif -out results.sarif ./...' | |
| - name: Upload SARIF to GitHub | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: results.sarif | |
| # ======================================== | |
| # Final Status Check | |
| # ======================================== | |
| ci-success: | |
| name: ✅ CI Success | |
| runs-on: ubuntu-latest | |
| needs: [quality, test, security] | |
| if: always() | |
| steps: | |
| - name: Check all jobs status | |
| run: | | |
| if [[ "${{ needs.quality.result }}" != "success" ]]; then | |
| echo "Quality gate failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.test.result }}" != "success" ]]; then | |
| echo "Tests failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.security.result }}" != "success" ]]; then | |
| echo "Security scan failed" | |
| exit 1 | |
| fi | |
| echo "All CI checks passed! 🎉" |