235 lines
8.6 KiB
YAML
235 lines
8.6 KiB
YAML
name: cloud-runner-integrity
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
runGithubIntegrationTests:
|
|
description: 'Run GitHub Checks integration tests'
|
|
required: false
|
|
default: 'false'
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
checks: write
|
|
statuses: write
|
|
|
|
env:
|
|
# Commented out: Using LocalStack tests instead of real AWS
|
|
# AWS_REGION: eu-west-2
|
|
# AWS_DEFAULT_REGION: eu-west-2
|
|
AWS_STACK_NAME: game-ci-team-pipelines # Still needed for LocalStack S3 bucket creation
|
|
CLOUD_RUNNER_BRANCH: ${{ github.ref }}
|
|
DEBUG: true
|
|
PROJECT_PATH: test-project
|
|
USE_IL2CPP: false
|
|
|
|
jobs:
|
|
k8s:
|
|
name: Cloud Runner Tests (K8s)
|
|
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:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: false
|
|
# Set up Kubernetes (k3s via k3d) only for k8s matrix entries
|
|
- name: Set up kubectl
|
|
if: ${{ matrix.provider == 'k8s' }}
|
|
uses: azure/setup-kubectl@v4
|
|
with:
|
|
version: 'v1.34.1'
|
|
- name: Install k3d
|
|
if: ${{ matrix.provider == 'k8s' }}
|
|
run: |
|
|
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
|
|
k3d version | cat
|
|
- name: Create k3s cluster (k3d)
|
|
if: ${{ matrix.provider == 'k8s' }}
|
|
run: |
|
|
# Create cluster with relaxed eviction thresholds to prevent premature evictions
|
|
k3d cluster create unity-builder \
|
|
--agents 1 \
|
|
--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
|
|
- name: Verify cluster readiness
|
|
if: ${{ matrix.provider == 'k8s' }}
|
|
run: |
|
|
for i in {1..60}; do kubectl get nodes && break || sleep 5; done
|
|
kubectl get storageclass
|
|
# Show node resources
|
|
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)
|
|
uses: localstack/setup-localstack@v0.2.4
|
|
with:
|
|
install-awslocal: true
|
|
- name: Create S3 bucket for tests (host LocalStack)
|
|
run: |
|
|
awslocal s3 mb s3://$AWS_STACK_NAME || true
|
|
awslocal s3 ls
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'yarn'
|
|
- name: Clean up disk space before tests
|
|
run: |
|
|
# Clean up any leftover cache files from previous runs
|
|
rm -rf ./cloud-runner-cache/* || true
|
|
# Clean up system caches and temporary files
|
|
sudo apt-get clean || true
|
|
docker system prune -f || true
|
|
# Show available disk space
|
|
df -h
|
|
- run: yarn install --frozen-lockfile
|
|
- run: yarn run test "${{ matrix.test }}" --detectOpenHandles --forceExit --runInBand
|
|
timeout-minutes: 60
|
|
env:
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
|
|
PROJECT_PATH: test-project
|
|
TARGET_PLATFORM: StandaloneWindows64
|
|
cloudRunnerTests: true
|
|
versioning: None
|
|
KUBE_STORAGE_CLASS: ${{ matrix.provider == 'k8s' && 'local-path' || '' }}
|
|
PROVIDER_STRATEGY: ${{ matrix.provider }}
|
|
# Set lower resource requests for tests to prevent evictions in k3d
|
|
containerCpu: ${{ matrix.provider == 'k8s' && '512' || '' }}
|
|
containerMemory: ${{ matrix.provider == 'k8s' && '512' || '' }}
|
|
AWS_ACCESS_KEY_ID: test
|
|
AWS_SECRET_ACCESS_KEY: test
|
|
AWS_S3_ENDPOINT: http://localhost:4566
|
|
AWS_ENDPOINT: http://localhost:4566
|
|
INPUT_AWSS3ENDPOINT: http://localhost:4566
|
|
INPUT_AWSENDPOINT: http://localhost:4566
|
|
AWS_S3_FORCE_PATH_STYLE: 'true'
|
|
AWS_EC2_METADATA_DISABLED: 'true'
|
|
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
|
localstack:
|
|
name: Cloud Runner Tests (LocalStack)
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
localstack:
|
|
image: localstack/localstack
|
|
ports:
|
|
- 4566:4566
|
|
env:
|
|
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:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'yarn'
|
|
- name: Clean up disk space before tests
|
|
run: |
|
|
# Clean up any leftover cache files from previous runs
|
|
rm -rf ./cloud-runner-cache/* || true
|
|
# Clean up system caches and temporary files
|
|
sudo apt-get clean || true
|
|
docker system prune -f || true
|
|
# Show available disk space
|
|
df -h
|
|
- run: yarn install --frozen-lockfile
|
|
- run: yarn run test "${{ matrix.test }}" --detectOpenHandles --forceExit --runInBand
|
|
timeout-minutes: 60
|
|
env:
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
|
|
PROJECT_PATH: test-project
|
|
TARGET_PLATFORM: StandaloneWindows64
|
|
cloudRunnerTests: true
|
|
versioning: None
|
|
KUBE_STORAGE_CLASS: local-path
|
|
PROVIDER_STRATEGY: aws
|
|
AWS_ACCESS_KEY_ID: test
|
|
AWS_SECRET_ACCESS_KEY: test
|
|
AWS_ENDPOINT: http://localhost:4566
|
|
AWS_ENDPOINT_URL: http://localhost:4566
|
|
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
|
# Commented out: Using LocalStack tests instead of real AWS
|
|
# aws:
|
|
# name: Cloud Runner Tests (AWS)
|
|
# runs-on: ubuntu-latest
|
|
# needs: [k8s, localstack]
|
|
# strategy:
|
|
# fail-fast: false
|
|
# matrix:
|
|
# test:
|
|
# - 'cloud-runner-end2end-caching'
|
|
# - 'cloud-runner-end2end-retaining'
|
|
# - 'cloud-runner-hooks'
|
|
# steps:
|
|
# - uses: actions/checkout@v4
|
|
# with:
|
|
# lfs: false
|
|
# - name: Configure AWS Credentials
|
|
# uses: aws-actions/configure-aws-credentials@v1
|
|
# with:
|
|
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
# aws-region: ${{ env.AWS_REGION }}
|
|
# - uses: actions/setup-node@v4
|
|
# with:
|
|
# node-version: 20
|
|
# cache: 'yarn'
|
|
# - run: yarn install --frozen-lockfile
|
|
# - run: yarn run test "${{ matrix.test }}" --detectOpenHandles --forceExit --runInBand
|
|
# timeout-minutes: 60
|
|
# env:
|
|
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
|
|
# PROJECT_PATH: test-project
|
|
# TARGET_PLATFORM: StandaloneWindows64
|
|
# cloudRunnerTests: true
|
|
# versioning: None
|
|
# PROVIDER_STRATEGY: aws
|
|
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
# GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
|
# GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|