144 lines
8.2 KiB
YAML
144 lines
8.2 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'
|
|
UNITY_LICENSE: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"576562626572264761624c65526f7578\"/>\n <Binding Key=\"2\" Value=\"576562626572264761624c65526f7578\"/>\n </MachineBindings>\n <MachineID Value=\"D7nTUnjNAmtsUMcnoyrqkgIbYdM=\"/>\n <SerialHash Value=\"2033b8ac3e6faa3742ca9f0bfae44d18f2a96b80\"/>\n <Features>\n <Feature Value=\"33\"/>\n <Feature Value=\"1\"/>\n <Feature Value=\"12\"/>\n <Feature Value=\"2\"/>\n <Feature Value=\"24\"/>\n <Feature Value=\"3\"/>\n <Feature Value=\"36\"/>\n <Feature Value=\"17\"/>\n <Feature Value=\"19\"/>\n <Feature Value=\"62\"/>\n </Features>\n <DeveloperData Value=\"AQAAAEY0LUJHUlgtWEQ0RS1aQ1dWLUM1SlctR0RIQg==\"/>\n <SerialMasked Value=\"F4-BGRX-XD4E-ZCWV-C5JW-XXXX\"/>\n <StartDate Value=\"2021-02-08T00:00:00\"/>\n <UpdateDate Value=\"2021-02-09T00:34:57\"/>\n <InitialActivationDate Value=\"2021-02-08T00:34:56\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2018.4.30f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" ValidTo=\"9999-12-31T00:00:00\"/>\n <Entitlement Ns=\"unity_editor\" Tag=\"DarkSkin\" Type=\"EDITOR_FEATURE\" ValidTo=\"9999-12-31T00:00:00\"/>\n </Entitlements>\n </License>\n<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#Terms\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>m0Db8UK+ktnOLJBtHybkfetpcKo=</DigestValue></Reference></SignedInfo><SignatureValue>o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==</SignatureValue></Signature></root>"
|
|
|
|
jobs:
|
|
k8sBuilds:
|
|
name: K8s (GKE Autopilot) build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
targetPlatform:
|
|
- StandaloneLinux64
|
|
- StandaloneWindows64
|
|
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 }}
|
|
DEBUG: true
|
|
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_BRANCH: remote-builder/unified-providers
|
|
GCP_LOGGING: true
|
|
GCP_PROJECT: unitykubernetesbuilder
|
|
GCP_LOG_NAME: game-ci
|
|
CLOUD_RUNNER_TESTS: true
|
|
# Use FUSE to mount a storage bucket to a cache folder
|
|
EXPERIMENTAL_HOOK: |
|
|
- name: FUSE filesystem to s3 for global scale caching
|
|
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
|
|
|
|
###########################
|
|
# Cloud Runner Build Test #
|
|
###########################
|
|
- name: Cloud Runner Build Test
|
|
uses: ./
|
|
id: k8s-unity-build
|
|
env:
|
|
CloudRunnerBranch: remote-builder/unified-providers
|
|
DEBUG: true
|
|
GCP_LOG_FILE: $GITHUB_WORKSPACE/cloud-runner-logs
|
|
INIT_HOOK: touch $GCP_LOG_FILE && tail -f $GCP_LOG_FILE | xargs -I{} gcloud logging write game-ci "{}"
|
|
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
|
|
cloudRunnerTests: true
|
|
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
|