name: Egress Tests on: pull_request: branches: [ main ] permissions: contents: read pull-requests: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: changes: uses: ./.github/workflows/detect-changes.yml with: area: egress test: needs: changes if: needs.changes.outputs.relevant == 'true' runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v6 with: go-version: '1.25.9' - name: Check gofmt working-directory: components/egress run: | files="$(gofmt -l . ../internal)" if [ -n "$files" ]; then echo "$files" exit 1 fi - name: Run Build working-directory: components/egress run: | go vet ./... go build . - name: Run tests working-directory: components/egress run: | go test ./... smoke: needs: changes if: needs.changes.outputs.relevant == 'true' runs-on: self-hosted steps: - name: Checkout code uses: actions/checkout@v6 - name: Clean Docker runner cache run: bash scripts/ci-docker-cleanup.sh - name: Run dns test working-directory: components/egress run: | chmod +x tests/smoke-dns.sh ./tests/smoke-dns.sh - name: Run nft test working-directory: components/egress run: | chmod +x tests/smoke-nft.sh ./tests/smoke-nft.sh - name: Run dynamic ip test working-directory: components/egress run: | chmod +x tests/smoke-dynamic-ip.sh ./tests/smoke-dynamic-ip.sh - name: Run dns upstream probe test working-directory: components/egress run: | chmod +x tests/smoke-dns-upstream-probe.sh ./tests/smoke-dns-upstream-probe.sh bench: needs: changes if: needs.changes.outputs.relevant == 'true' runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v6 - name: Run bench test working-directory: components/egress run: | chmod +x tests/bench-dns-nft.sh ./tests/bench-dns-nft.sh env: BENCH_SAMPLE_SIZE: "20" - name: Upload egress logs if: always() uses: actions/upload-artifact@v7 with: name: egress-log-for-bench path: /tmp/egress-logs/ retention-days: 5 required: name: Egress CI if: always() needs: [changes, test, smoke, bench] runs-on: ubuntu-latest steps: - name: Verify required jobs env: RELEVANT: ${{ needs.changes.outputs.relevant }} CHANGES_RESULT: ${{ needs.changes.result }} TEST_RESULT: ${{ needs.test.result }} SMOKE_RESULT: ${{ needs.smoke.result }} BENCH_RESULT: ${{ needs.bench.result }} run: | if [[ "$CHANGES_RESULT" != "success" ]]; then echo "Change detection failed: $CHANGES_RESULT" exit 1 fi if [[ "$RELEVANT" == "true" ]]; then [[ "$TEST_RESULT" == "success" && "$SMOKE_RESULT" == "success" && "$BENCH_RESULT" == "success" ]] else [[ "$RELEVANT" == "false" && "$TEST_RESULT" == "skipped" && "$SMOKE_RESULT" == "skipped" && "$BENCH_RESULT" == "skipped" ]] fi