145 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			YAML
		
	
	
			
		
		
	
	
			145 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			YAML
		
	
	
| name: Cloud Runner - K8s Tests
 | |
| 
 | |
| on:
 | |
|   push: { branches: [remote-builder/k8s, remote-builder/unified-providers] }
 | |
| #  push: { branches: [main] }
 | |
| #  pull_request:
 | |
| #    paths-ignore:
 | |
| #      - '.github/**'
 | |
| 
 | |
| env:
 | |
|   GKE_ZONE: 'us-central1'
 | |
|   GKE_REGION: 'us-central1'
 | |
|   GKE_PROJECT: 'unitykubernetesbuilder'
 | |
|   GKE_CLUSTER: 'unity-builder-cluster'
 | |
|   GCP_LOGGING: true
 | |
|   GCP_PROJECT: unitykubernetesbuilder
 | |
|   GCP_LOG_FILE: ${{ github.workspace }}/cloud-runner-logs.txt
 | |
|   AWS_REGION: eu-west-2
 | |
|   AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
 | |
|   AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
 | |
|   AWS_DEFAULT_REGION: eu-west-2
 | |
|   AWS_BASE_STACK_NAME: game-ci-github-pipelines
 | |
|   CLOUD_RUNNER_BRANCH: remote-builder/unified-providers
 | |
|   CLOUD_RUNNER_TESTS: true
 | |
|   DEBUG: true
 | |
|   UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
 | |
| 
 | |
| jobs:
 | |
|   k8sBuilds:
 | |
|     name: K8s (GKE Autopilot) build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
 | |
|     runs-on: ubuntu-latest
 | |
|     strategy:
 | |
|       fail-fast: false
 | |
|       matrix:
 | |
|         unityVersion:
 | |
|           #  - 2019.2.11f1
 | |
|           - 2019.3.15f1
 | |
|         targetPlatform:
 | |
|           - StandaloneWindows64
 | |
|           - StandaloneLinux64
 | |
|     steps:
 | |
|       ###########################
 | |
|       #         Checkout        #
 | |
|       ###########################
 | |
|       - uses: actions/checkout@v2
 | |
|         if: github.event.event_type != 'pull_request_target'
 | |
|         with:
 | |
|           lfs: true
 | |
| 
 | |
|       ###########################
 | |
|       #          Setup          #
 | |
|       ###########################
 | |
|       - uses: google-github-actions/setup-gcloud@master
 | |
|         with:
 | |
|           version: '288.0.0'
 | |
|           service_account_email: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_EMAIL }}
 | |
|           service_account_key: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}
 | |
|       - name: Get GKE cluster credentials
 | |
|         run: gcloud container clusters get-credentials $GKE_CLUSTER --zone $GKE_ZONE --project $GKE_PROJECT
 | |
| 
 | |
|       ###########################
 | |
|       # Cloud Runner Test Suite #
 | |
|       ###########################
 | |
|       - uses: actions/setup-node@v2
 | |
|         with:
 | |
|           node-version: 12.x
 | |
|       - run: yarn
 | |
|       - run: yarn run cli --help
 | |
|       - name: Cloud Runner Test Suite
 | |
|         run: yarn run test-i-k8s
 | |
|         env:
 | |
|           UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
 | |
|           PROJECT_PATH: ${{ matrix.projectPath }}
 | |
|           UNITY_VERSION: ${{ matrix.unityVersion }}
 | |
|           TARGET_PLATFORM: ${{ matrix.targetPlatform }}
 | |
|           GITHUUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | |
|           KUBE_CONFIG: ${{ steps.read-base64.outputs.base64 }}
 | |
| 
 | |
|       ###########################
 | |
|       # Cloud Runner Build Test #
 | |
|       ###########################
 | |
|       - name: Cloud Runner Build Test
 | |
|         uses: ./
 | |
|         id: k8s-unity-build
 | |
|         with:
 | |
|           cloudRunnerCluster: k8s
 | |
|           UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
 | |
|           targetPlatform: ${{ matrix.targetPlatform }}
 | |
|           kubeConfig: ${{ steps.read-base64.outputs.base64 }}
 | |
|           githubToken: ${{ secrets.GITHUB_TOKEN }}
 | |
|           projectPath: test-project
 | |
|           unityVersion: ${{ matrix.targetPlatform }}
 | |
|           versioning: None
 | |
|           EXPERIMENTAL_HOOK: |
 | |
|             - name: FUSE filesystem to s3
 | |
|               hook: [ before ]
 | |
|               step: [ setup ]
 | |
|               commands: |
 | |
|                 sudo amazon-linux-extras install epel
 | |
|                 sudo yum install s3fs-fuse
 | |
|                 aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID --profile default
 | |
|                 aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile default
 | |
|                 aws configure set region $AWS_DEFAULT_REGION --profile default
 | |
|                 echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs
 | |
|                 chmod 600 ${HOME}/.passwd-s3fs
 | |
|                 s3fs game-ci-test-storage /data/cache -o passwd_file=${HOME}/.passwd-s3fs
 | |
|               secrets:
 | |
|               - name: awsAccessKeyId
 | |
|                 value: ${{ secrets.AWS_ACCESS_KEY_ID }}
 | |
|               - name: awsSecretAccessKey
 | |
|                 value: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
 | |
|               - name: awsDefaultRegion
 | |
|                 value: eu-west-2            
 | |
|           postBuildSteps: |
 | |
|             - name: upload
 | |
|               image: amazon/aws-cli
 | |
|               commands: |
 | |
|                 aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID --profile default
 | |
|                 aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile default
 | |
|                 aws configure set region $AWS_DEFAULT_REGION --profile default
 | |
|                 aws s3 ls
 | |
|                 aws s3 ls game-ci-test-storage
 | |
|                 ls /data/cache/$BRANCH
 | |
|                 echo "/data/cache/$BRANCH/build-$BUILD_GUID.zip s3://game-ci-test-storage/$BRANCH/$BUILD_FILE"
 | |
|                 aws s3 cp /data/cache/$BRANCH/build-$BUILD_GUID.zip s3://game-ci-test-storage/$BRANCH/build-$BUILD_GUID.zip
 | |
|               secrets:
 | |
|               - name: awsAccessKeyId
 | |
|                 value: ${{ secrets.AWS_ACCESS_KEY_ID }}
 | |
|               - name: awsSecretAccessKey
 | |
|                 value: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
 | |
|               - name: awsDefaultRegion
 | |
|                 value: eu-west-2            
 | |
|       - run: |
 | |
|           aws s3 cp s3://game-ci-test-storage/${{ steps.aws-fargate-unity-build.outputs.BRANCH }}/build-${{ steps.aws-fargate-unity-build.outputs.BUILD_GUID }}.zip build-${{ steps.aws-fargate-unity-build.outputs.BUILD_GUID }}.zip
 | |
|           ls          
 | |
|       ###########################
 | |
|       #          Upload         #
 | |
|       ###########################
 | |
|       # download from cloud storage
 | |
|       - uses: actions/upload-artifact@v2
 | |
|         with:
 | |
|           name: K8s Build (${{ matrix.targetPlatform }})
 | |
|           path: build-${{ steps.k8s-unity-build.outputs.BUILD_GUID }}.zip
 | |
|           retention-days: 14
 |