Continuous Testing (CT) #93
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 Testing (CT) | |
| on: | |
| repository_dispatch: | |
| types: [deployment-complete] | |
| schedule: | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| test_suite: | |
| description: 'Test suite to run' | |
| type: choice | |
| options: | |
| - all | |
| - integration | |
| - e2e | |
| - functional | |
| - performance | |
| default: all | |
| permissions: | |
| contents: read | |
| checks: write | |
| packages: read | |
| jobs: | |
| ct-integration: | |
| name: "CT: Integration Tests" | |
| runs-on: qnap-nas | |
| if: >- | |
| github.event_name != 'workflow_dispatch' || | |
| github.event.inputs.test_suite == 'all' || | |
| github.event.inputs.test_suite == 'integration' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Install gotestsum | |
| run: GOTOOLCHAIN=auto go install gotest.tools/gotestsum@latest | |
| - name: Run integration tests | |
| run: | | |
| gotestsum \ | |
| --junitfile ct-integration-results.xml \ | |
| --format pkgname \ | |
| -- -race -tags=integration -count=1 -timeout=10m ./test/integration/... | |
| - name: Upload test report | |
| if: always() | |
| uses: dorny/test-reporter@71f2f95ef0c4a3656e44272deca4a1efe096628a # v1 | |
| with: | |
| name: "CT: Integration Tests" | |
| path: ct-integration-results.xml | |
| reporter: java-junit | |
| fail-on-error: false | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ct-integration-report | |
| path: ct-integration-results.xml | |
| retention-days: 30 | |
| ct-e2e: | |
| name: "CT: E2E Tests" | |
| runs-on: qnap-nas | |
| if: >- | |
| github.event_name != 'workflow_dispatch' || | |
| github.event.inputs.test_suite == 'all' || | |
| github.event.inputs.test_suite == 'e2e' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Install gotestsum | |
| run: GOTOOLCHAIN=auto go install gotest.tools/gotestsum@latest | |
| - name: Run E2E tests | |
| run: | | |
| gotestsum \ | |
| --junitfile ct-e2e-results.xml \ | |
| --format pkgname \ | |
| -- -tags=e2e -count=1 -timeout=30m ./test/e2e/... | |
| - name: Upload test report | |
| if: always() | |
| uses: dorny/test-reporter@71f2f95ef0c4a3656e44272deca4a1efe096628a # v1 | |
| with: | |
| name: "CT: E2E Tests" | |
| path: ct-e2e-results.xml | |
| reporter: java-junit | |
| fail-on-error: false | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ct-e2e-report | |
| path: ct-e2e-results.xml | |
| retention-days: 30 | |
| ct-functional: | |
| name: "CT: Functional Tests" | |
| runs-on: qnap-nas | |
| if: >- | |
| github.event_name != 'workflow_dispatch' || | |
| github.event.inputs.test_suite == 'all' || | |
| github.event.inputs.test_suite == 'functional' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Install gotestsum | |
| run: GOTOOLCHAIN=auto go install gotest.tools/gotestsum@latest | |
| - name: Run functional tests | |
| run: | | |
| gotestsum \ | |
| --junitfile ct-functional-results.xml \ | |
| --format pkgname \ | |
| -- -tags=functional -count=1 -timeout=15m ./test/functional/... | |
| - name: Upload test report | |
| if: always() | |
| uses: dorny/test-reporter@71f2f95ef0c4a3656e44272deca4a1efe096628a # v1 | |
| with: | |
| name: "CT: Functional Tests" | |
| path: ct-functional-results.xml | |
| reporter: java-junit | |
| fail-on-error: false | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ct-functional-report | |
| path: ct-functional-results.xml | |
| retention-days: 30 | |
| ct-performance: | |
| name: "CT: Performance Tests" | |
| runs-on: qnap-nas | |
| if: >- | |
| github.event_name != 'workflow_dispatch' || | |
| github.event.inputs.test_suite == 'all' || | |
| github.event.inputs.test_suite == 'performance' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Run benchmarks | |
| run: | | |
| go test -bench=. -benchmem -count=3 -timeout=30m \ | |
| ./internal/agent/router/... \ | |
| ./internal/agent/lb/... \ | |
| ./internal/agent/upstream/... \ | |
| ./internal/agent/policy/... \ | |
| 2>&1 | tee benchmark-results.txt | |
| - name: Generate summary | |
| if: always() | |
| run: | | |
| echo "## Performance Benchmark Results" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| head -200 benchmark-results.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ct-performance-report | |
| path: benchmark-results.txt | |
| retention-days: 30 | |
| ct-summary: | |
| name: "CT: Summary" | |
| runs-on: qnap-nas | |
| needs: [ct-integration, ct-e2e, ct-functional, ct-performance] | |
| if: always() | |
| steps: | |
| - name: Generate CT summary | |
| run: | | |
| echo "## Continuous Testing Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Suite | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Integration | ${{ needs.ct-integration.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| E2E | ${{ needs.ct-e2e.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Functional | ${{ needs.ct-functional.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Performance | ${{ needs.ct-performance.result }} |" >> $GITHUB_STEP_SUMMARY |