docs: add compliance event reporting to filter scripts and documentation #961
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 Tests | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - ready_for_review | |
| - labeled | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| env: | |
| GOPRIVATE: github.com/TykTechnologies | |
| jobs: | |
| # ========================================================================== | |
| # Dependency Guard | |
| # ========================================================================== | |
| dep-guard: | |
| uses: TykTechnologies/github-actions/.github/workflows/dependency-guard.yml@d3fa20888fa2878e877e22bb7702141217290e7c # main | |
| permissions: | |
| contents: read | |
| # ========================================================================== | |
| # Go Linting (disabled for now) | |
| # ========================================================================== | |
| golangci-lint: | |
| if: false | |
| runs-on: warp-ubuntu-latest-arm64-4x | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Fetch base branch | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: git fetch origin ${{ github.base_ref }} | |
| - name: golangci-lint | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3 | |
| with: | |
| version: latest | |
| args: --out-format=checkstyle:golanglint.xml --timeout=600s --max-issues-per-linter=0 --max-same-issues=0 --new-from-rev=origin/${{ github.base_ref }} | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: golangcilint | |
| retention-days: 1 | |
| path: | | |
| golanglint.xml | |
| # ========================================================================== | |
| # Frontend Tests (Jest) | |
| # ========================================================================== | |
| frontend-tests: | |
| needs: [dep-guard] | |
| name: Frontend Tests | |
| runs-on: warp-ubuntu-latest-arm64-2x | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: "**/package-lock.json" | |
| - name: Install and Test Frontend | |
| env: | |
| CI: true | |
| run: | | |
| cd ui/admin-frontend | |
| npm ci --ignore-scripts | |
| npm rebuild | |
| npm test -- --forceExit | |
| - name: Build Frontend | |
| run: | | |
| cd ui/admin-frontend | |
| CI=false npm run build | |
| # ========================================================================== | |
| # Go Unit Tests (Studio + Microgateway) - Matrix for CE/ENT | |
| # ========================================================================== | |
| go-unit-tests: | |
| needs: [dep-guard] | |
| name: Go Unit Tests (${{ matrix.edition }}) | |
| runs-on: warp-ubuntu-latest-arm64-4x | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| edition: [ce, ent] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| fetch-depth: 2 | |
| submodules: ${{ matrix.edition == 'ent' }} | |
| token: ${{ secrets.CI_SUBMODULE_PAT }} | |
| - name: Create enterprise stub for CE builds | |
| if: matrix.edition == 'ce' | |
| run: | | |
| mkdir -p enterprise | |
| cat > enterprise/go.mod << 'EOF' | |
| module github.com/TykTechnologies/midsommar/v2/enterprise | |
| go 1.25.6 | |
| EOF | |
| - name: Setup Go | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Go Cache | |
| uses: WarpBuilds/cache@f643a1ba29942d56621d07fc2d4284c7219868ad # v1 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ matrix.edition }}-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go-${{ matrix.edition }}- | |
| ${{ runner.os }}-go- | |
| - name: Set build tags | |
| id: tags | |
| run: | | |
| if [ "${{ matrix.edition }}" == "ent" ]; then | |
| echo "BUILD_TAGS=-tags enterprise" >> $GITHUB_OUTPUT | |
| else | |
| echo "BUILD_TAGS=" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Verify Go dependencies | |
| run: | | |
| go mod verify | |
| cd microgateway && go mod verify | |
| - name: Create placeholders for embeds | |
| run: | | |
| # Create placeholder for docs embed (tests don't need actual docs) | |
| mkdir -p docs/site/dist | |
| echo "placeholder" > docs/site/dist/index.html | |
| # Create placeholder for frontend embed (tests don't need actual frontend) | |
| mkdir -p ui/admin-frontend/build | |
| echo "placeholder" > ui/admin-frontend/build/index.html | |
| # Use dev environment template for tests | |
| cp dev/.env.dev .env | |
| - name: Run AI Studio Unit Tests | |
| run: | | |
| go test ${{ steps.tags.outputs.BUILD_TAGS }} -v -race -short \ | |
| -coverprofile=coverage-studio-${{ matrix.edition }}.out \ | |
| -covermode=atomic ./... | |
| - name: Run Microgateway Unit Tests | |
| run: | | |
| cd microgateway | |
| go test ${{ steps.tags.outputs.BUILD_TAGS }} -v -race -short \ | |
| -coverprofile=../coverage-microgateway-${{ matrix.edition }}.out \ | |
| -covermode=atomic ./... | |
| - name: Upload Coverage | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: coverage-${{ matrix.edition }} | |
| path: coverage-*.out | |
| retention-days: 7 | |
| # ========================================================================== | |
| # Documentation Build | |
| # ========================================================================== | |
| docs-build: | |
| needs: [dep-guard] | |
| name: Documentation Build | |
| runs-on: warp-ubuntu-latest-arm64-2x | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: "docs/site/package-lock.json" | |
| - name: Cache VitePress | |
| uses: WarpBuilds/cache@f643a1ba29942d56621d07fc2d4284c7219868ad # v1 | |
| with: | |
| path: docs/site/.vitepress/cache | |
| key: ${{ runner.os }}-vitepress-${{ hashFiles('docs/site/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-vitepress- | |
| - name: Build Documentation | |
| run: | | |
| cp .env.example .env | |
| cd docs/site | |
| npm ci --ignore-scripts | |
| npm rebuild | |
| NODE_ENV=production npm run docs:build | |
| # ========================================================================== | |
| # Test Summary | |
| # ========================================================================== | |
| test-summary: | |
| name: Test Summary | |
| runs-on: warp-ubuntu-latest-arm64-2x | |
| needs: [frontend-tests, go-unit-tests, docs-build] | |
| if: always() | |
| steps: | |
| - name: Download Coverage Artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| pattern: coverage-* | |
| merge-multiple: true | |
| continue-on-error: true | |
| - name: Generate Summary | |
| run: | | |
| echo "# CI Test Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Frontend Tests | ${{ needs.frontend-tests.result == 'success' && ':white_check_mark:' || ':x:' }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Go Unit Tests (CE) | ${{ contains(needs.go-unit-tests.result, 'success') && ':white_check_mark:' || ':x:' }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Go Unit Tests (ENT) | ${{ contains(needs.go-unit-tests.result, 'success') && ':white_check_mark:' || ':x:' }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Documentation Build | ${{ needs.docs-build.result == 'success' && ':white_check_mark:' || ':x:' }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Coverage files:" >> $GITHUB_STEP_SUMMARY | |
| ls -la coverage-*.out 2>/dev/null || echo "No coverage files found" | |
| - name: Upload Combined Coverage | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: coverage-combined | |
| path: coverage-*.out | |
| retention-days: 30 | |
| continue-on-error: true | |
| - name: Check Results | |
| if: needs.frontend-tests.result != 'success' || needs.go-unit-tests.result != 'success' | |
| run: | | |
| echo "Some tests failed!" | |
| exit 1 |