feat: addresource optimization service #12
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: E2E Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "hk/**" | |
| - "feature/**" | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| # Run E2E tests daily at 2 AM UTC | |
| - cron: "0 2 * * *" | |
| # Cancel in-progress runs for the same workflow and ref | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| checks: write | |
| jobs: | |
| test-e2e: | |
| name: E2E Tests (Kubernetes ${{ matrix.k8s-version }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| k8s-version: ["v1.34.1", "v1.33.0"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| cache-dependency-path: | | |
| go.sum | |
| - name: Cache Docker layers | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-e2e-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx-e2e- | |
| ${{ runner.os }}-buildx- | |
| - name: Cache Kind images | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/kind-images | |
| key: ${{ runner.os }}-kind-${{ matrix.k8s-version }} | |
| restore-keys: | | |
| ${{ runner.os }}-kind- | |
| - name: Install Kind | |
| run: | | |
| KIND_VERSION="v0.25.0" | |
| curl -Lo ./kind "https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64" | |
| chmod +x ./kind | |
| sudo mv ./kind /usr/local/bin/kind | |
| - name: Verify Kind installation | |
| run: kind version | |
| - name: Free up disk space | |
| run: | | |
| echo "Before cleanup:" | |
| df -h | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf "/usr/local/share/boost" | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| echo "After cleanup:" | |
| df -h | |
| - name: Download dependencies | |
| run: go mod download && go mod verify | |
| - name: Run E2E tests | |
| id: e2e-test | |
| run: | | |
| set -o pipefail | |
| make test-e2e 2>&1 | tee e2e-test-output.log | |
| env: | |
| KIND_CLUSTER: helios-operator-test-e2e-${{ matrix.k8s-version }} | |
| - name: Collect Kind cluster logs on failure | |
| if: failure() && steps.e2e-test.outcome == 'failure' | |
| run: | | |
| mkdir -p /tmp/kind-logs | |
| kind export logs /tmp/kind-logs --name helios-operator-test-e2e-${{ matrix.k8s-version }} || true | |
| - name: Upload E2E test logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-logs-k8s-${{ matrix.k8s-version }} | |
| path: | | |
| e2e-test-output.log | |
| /tmp/kind-logs/ | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| - name: Cleanup Kind cluster | |
| if: always() | |
| run: | | |
| kind delete cluster --name helios-operator-test-e2e-${{ matrix.k8s-version }} || true | |
| test-e2e-summary: | |
| name: E2E Test Summary | |
| runs-on: ubuntu-latest | |
| needs: test-e2e | |
| if: always() | |
| steps: | |
| - name: Check E2E test results | |
| run: | | |
| if [ "${{ needs.test-e2e.result }}" != "success" ]; then | |
| echo "❌ E2E tests failed" | |
| exit 1 | |
| else | |
| echo "✅ All E2E tests passed" | |
| fi |