PR feedback
parent
86aae1e20f
commit
69731babfc
|
|
@ -28,61 +28,41 @@ jobs:
|
||||||
k8s:
|
k8s:
|
||||||
name: Cloud Runner Tests (K8s)
|
name: Cloud Runner Tests (K8s)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
# K8s runs (k3s)
|
|
||||||
- test: 'cloud-runner-end2end-caching'
|
|
||||||
provider: k8s
|
|
||||||
- test: 'cloud-runner-end2end-retaining'
|
|
||||||
provider: k8s
|
|
||||||
- test: 'cloud-runner-hooks'
|
|
||||||
provider: k8s
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
lfs: false
|
lfs: false
|
||||||
# Set up Kubernetes (k3s via k3d) only for k8s matrix entries
|
# Set up Kubernetes (k3s via k3d)
|
||||||
- name: Set up kubectl
|
- name: Set up kubectl
|
||||||
if: ${{ matrix.provider == 'k8s' }}
|
|
||||||
uses: azure/setup-kubectl@v4
|
uses: azure/setup-kubectl@v4
|
||||||
with:
|
with:
|
||||||
version: 'v1.34.1'
|
version: 'v1.34.1'
|
||||||
- name: Install k3d
|
- name: Install k3d
|
||||||
if: ${{ matrix.provider == 'k8s' }}
|
|
||||||
run: |
|
run: |
|
||||||
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
|
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
|
||||||
k3d version | cat
|
k3d version | cat
|
||||||
- name: Create k3s cluster (k3d)
|
- name: Create k3s cluster (k3d)
|
||||||
if: ${{ matrix.provider == 'k8s' }}
|
timeout-minutes: 5
|
||||||
run: |
|
run: |
|
||||||
# Create cluster with relaxed eviction thresholds to prevent premature evictions
|
# Create cluster with basic configuration
|
||||||
k3d cluster create unity-builder \
|
# Using simpler setup to avoid hangs - resource limits handled via container requests
|
||||||
--agents 1 \
|
k3d cluster create unity-builder --agents 1 --wait
|
||||||
--k3s-arg '--kubelet-arg=eviction-hard=memory.available<50Mi@agent:0' \
|
|
||||||
--k3s-arg '--kubelet-arg=eviction-soft=memory.available<100Mi@agent:0' \
|
|
||||||
--wait
|
|
||||||
kubectl config current-context | cat
|
kubectl config current-context | cat
|
||||||
- name: Verify cluster readiness
|
- name: Verify cluster readiness
|
||||||
if: ${{ matrix.provider == 'k8s' }}
|
timeout-minutes: 2
|
||||||
run: |
|
run: |
|
||||||
for i in {1..60}; do kubectl get nodes && break || sleep 5; done
|
for i in {1..60}; do
|
||||||
|
if kubectl get nodes 2>/dev/null | grep -q Ready; then
|
||||||
|
echo "Cluster is ready"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "Waiting for cluster... ($i/60)"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
kubectl get nodes
|
||||||
kubectl get storageclass
|
kubectl get storageclass
|
||||||
# Show node resources
|
# Show node resources
|
||||||
kubectl describe nodes | grep -A 5 "Allocated resources" || true
|
kubectl describe nodes | grep -A 5 "Allocated resources" || true
|
||||||
- name: Clean up old K8s resources before tests
|
|
||||||
if: ${{ matrix.provider == 'k8s' }}
|
|
||||||
run: |
|
|
||||||
# Clean up any leftover jobs, pods, and PVCs from previous test runs
|
|
||||||
kubectl delete jobs --all --ignore-not-found=true || true
|
|
||||||
kubectl delete pods --all --ignore-not-found=true || true
|
|
||||||
kubectl delete pvc --all --ignore-not-found=true || true
|
|
||||||
kubectl delete secrets --all --ignore-not-found=true || true
|
|
||||||
# Wait a moment for cleanup to complete
|
|
||||||
sleep 5
|
|
||||||
# Show current resource usage
|
|
||||||
kubectl top nodes 2>/dev/null || echo "Metrics server not available"
|
|
||||||
- name: Start LocalStack (S3)
|
- name: Start LocalStack (S3)
|
||||||
uses: localstack/setup-localstack@v0.2.4
|
uses: localstack/setup-localstack@v0.2.4
|
||||||
with:
|
with:
|
||||||
|
|
@ -105,8 +85,58 @@ jobs:
|
||||||
# Show available disk space
|
# Show available disk space
|
||||||
df -h
|
df -h
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- run: yarn run test "${{ matrix.test }}" --detectOpenHandles --forceExit --runInBand
|
- name: Run K8s tests sequentially
|
||||||
timeout-minutes: 60
|
timeout-minutes: 180
|
||||||
|
run: |
|
||||||
|
# List of K8s tests to run sequentially
|
||||||
|
tests=(
|
||||||
|
"cloud-runner-end2end-caching"
|
||||||
|
"cloud-runner-end2end-retaining"
|
||||||
|
"cloud-runner-hooks"
|
||||||
|
)
|
||||||
|
|
||||||
|
failed_tests=()
|
||||||
|
|
||||||
|
for test in "${tests[@]}"; do
|
||||||
|
echo "========================================="
|
||||||
|
echo "Running test: $test"
|
||||||
|
echo "========================================="
|
||||||
|
|
||||||
|
# Clean up K8s resources before each test
|
||||||
|
echo "Cleaning up K8s resources before test..."
|
||||||
|
kubectl delete jobs --all --ignore-not-found=true --all-namespaces || true
|
||||||
|
kubectl delete pods --all --ignore-not-found=true --all-namespaces || true
|
||||||
|
kubectl delete pvc --all --ignore-not-found=true --all-namespaces || true
|
||||||
|
kubectl delete secrets --all --ignore-not-found=true --all-namespaces || true
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
# Clean up disk space before each test
|
||||||
|
rm -rf ./cloud-runner-cache/* || true
|
||||||
|
docker system prune -f || true
|
||||||
|
|
||||||
|
# Run the test
|
||||||
|
if yarn run test "$test" --detectOpenHandles --forceExit --runInBand; then
|
||||||
|
echo "✓ Test $test passed"
|
||||||
|
else
|
||||||
|
echo "✗ Test $test failed"
|
||||||
|
failed_tests+=("$test")
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
|
# Report results
|
||||||
|
if [ ${#failed_tests[@]} -eq 0 ]; then
|
||||||
|
echo "========================================="
|
||||||
|
echo "All tests passed!"
|
||||||
|
echo "========================================="
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "========================================="
|
||||||
|
echo "Failed tests: ${failed_tests[*]}"
|
||||||
|
echo "========================================="
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
env:
|
env:
|
||||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||||
|
|
@ -115,11 +145,11 @@ jobs:
|
||||||
TARGET_PLATFORM: StandaloneWindows64
|
TARGET_PLATFORM: StandaloneWindows64
|
||||||
cloudRunnerTests: true
|
cloudRunnerTests: true
|
||||||
versioning: None
|
versioning: None
|
||||||
KUBE_STORAGE_CLASS: ${{ matrix.provider == 'k8s' && 'local-path' || '' }}
|
KUBE_STORAGE_CLASS: local-path
|
||||||
PROVIDER_STRATEGY: ${{ matrix.provider }}
|
PROVIDER_STRATEGY: k8s
|
||||||
# Set lower resource requests for tests to prevent evictions in k3d
|
# Set lower resource requests for tests to prevent evictions in k3d
|
||||||
containerCpu: ${{ matrix.provider == 'k8s' && '512' || '' }}
|
containerCpu: '512'
|
||||||
containerMemory: ${{ matrix.provider == 'k8s' && '512' || '' }}
|
containerMemory: '512'
|
||||||
AWS_ACCESS_KEY_ID: test
|
AWS_ACCESS_KEY_ID: test
|
||||||
AWS_SECRET_ACCESS_KEY: test
|
AWS_SECRET_ACCESS_KEY: test
|
||||||
AWS_S3_ENDPOINT: http://localhost:4566
|
AWS_S3_ENDPOINT: http://localhost:4566
|
||||||
|
|
@ -140,20 +170,6 @@ jobs:
|
||||||
- 4566:4566
|
- 4566:4566
|
||||||
env:
|
env:
|
||||||
SERVICES: cloudformation,ecs,kinesis,cloudwatch,s3,logs
|
SERVICES: cloudformation,ecs,kinesis,cloudwatch,s3,logs
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
test:
|
|
||||||
- 'cloud-runner-end2end-locking'
|
|
||||||
- 'cloud-runner-end2end-caching'
|
|
||||||
- 'cloud-runner-end2end-retaining'
|
|
||||||
- 'cloud-runner-caching'
|
|
||||||
- 'cloud-runner-environment'
|
|
||||||
- 'cloud-runner-image'
|
|
||||||
- 'cloud-runner-hooks'
|
|
||||||
- 'cloud-runner-local-persistence'
|
|
||||||
- 'cloud-runner-locking-core'
|
|
||||||
- 'cloud-runner-locking-get-locked'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -172,8 +188,58 @@ jobs:
|
||||||
# Show available disk space
|
# Show available disk space
|
||||||
df -h
|
df -h
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- run: yarn run test "${{ matrix.test }}" --detectOpenHandles --forceExit --runInBand
|
- name: Run LocalStack tests sequentially
|
||||||
timeout-minutes: 60
|
timeout-minutes: 300
|
||||||
|
run: |
|
||||||
|
# List of LocalStack tests to run sequentially
|
||||||
|
tests=(
|
||||||
|
"cloud-runner-end2end-locking"
|
||||||
|
"cloud-runner-end2end-caching"
|
||||||
|
"cloud-runner-end2end-retaining"
|
||||||
|
"cloud-runner-caching"
|
||||||
|
"cloud-runner-environment"
|
||||||
|
"cloud-runner-image"
|
||||||
|
"cloud-runner-hooks"
|
||||||
|
"cloud-runner-local-persistence"
|
||||||
|
"cloud-runner-locking-core"
|
||||||
|
"cloud-runner-locking-get-locked"
|
||||||
|
)
|
||||||
|
|
||||||
|
failed_tests=()
|
||||||
|
|
||||||
|
for test in "${tests[@]}"; do
|
||||||
|
echo "========================================="
|
||||||
|
echo "Running test: $test"
|
||||||
|
echo "========================================="
|
||||||
|
|
||||||
|
# Clean up disk space before each test
|
||||||
|
rm -rf ./cloud-runner-cache/* || true
|
||||||
|
docker system prune -f || true
|
||||||
|
df -h
|
||||||
|
|
||||||
|
# Run the test
|
||||||
|
if yarn run test "$test" --detectOpenHandles --forceExit --runInBand; then
|
||||||
|
echo "✓ Test $test passed"
|
||||||
|
else
|
||||||
|
echo "✗ Test $test failed"
|
||||||
|
failed_tests+=("$test")
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
|
# Report results
|
||||||
|
if [ ${#failed_tests[@]} -eq 0 ]; then
|
||||||
|
echo "========================================="
|
||||||
|
echo "All tests passed!"
|
||||||
|
echo "========================================="
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "========================================="
|
||||||
|
echo "Failed tests: ${failed_tests[*]}"
|
||||||
|
echo "========================================="
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
env:
|
env:
|
||||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue