mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-11 04:43:41 -04:00
182 lines
6.2 KiB
YAML
182 lines
6.2 KiB
YAML
name: Actions
|
|
|
|
on:
|
|
push: { branches: [main] }
|
|
pull_request_target:
|
|
paths-ignore:
|
|
- '.github/**'
|
|
|
|
env:
|
|
CODECOV_TOKEN: '2f2eb890-30e2-4724-83eb-7633832cf0de'
|
|
GKE_ZONE: 'us-central1-c'
|
|
GKE_REGION: 'us-central1'
|
|
GKE_PROJECT: 'unitykubernetesbuilder'
|
|
GKE_CLUSTER: 'unity-builder-cluster'
|
|
|
|
jobs:
|
|
tests:
|
|
name: Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 12.x
|
|
- run: yarn
|
|
- run: yarn lint
|
|
- run: yarn test --coverage
|
|
- run: bash <(curl -s https://codecov.io/bash)
|
|
- run: yarn build || { echo "build command should always succeed" ; exit 61; }
|
|
# - run: yarn build --quiet && git diff --quiet action || { echo "action should be auto generated" ; git diff action ; exit 62; }
|
|
buildForAllPlatforms:
|
|
name: Build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- test-project
|
|
unityVersion:
|
|
- 2019.2.11f1
|
|
- 2019.3.15f1
|
|
unityLicense:
|
|
- ${{ secrets.UNITY_LICENSE }}
|
|
targetPlatform:
|
|
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
|
|
- StandaloneWindows64 # Build a Windows 64-bit standalone.
|
|
- StandaloneLinux64 # Build a Linux 64-bit standalone.
|
|
- iOS # Build an iOS player.
|
|
# - Android # Build an Android .apk.
|
|
# - StandaloneWindows # Build a Windows standalone.
|
|
# - WebGL # WebGL.
|
|
# - WSAPlayer # Build an Windows Store Apps player.
|
|
# - PS4 # Build a PS4 Standalone.
|
|
# - XboxOne # Build a Xbox One Standalone.
|
|
# - tvOS # Build to Apple's tvOS platform.
|
|
# - Switch # Build a Nintendo Switch player
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- name: Checkout (default)
|
|
uses: actions/checkout@v2
|
|
if: github.event.event_type != 'pull_request_target'
|
|
with:
|
|
lfs: true
|
|
- name: Checkout (pull_request_target)
|
|
uses: actions/checkout@v2
|
|
if: github.event.event_type == 'pull_request_target'
|
|
with:
|
|
lfs: true
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
###########################
|
|
# Cache #
|
|
###########################
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
restore-keys: |
|
|
Library-${{ matrix.projectPath }}-
|
|
Library-
|
|
|
|
###########################
|
|
# Build #
|
|
###########################
|
|
- uses: ./
|
|
env:
|
|
UNITY_LICENSE: ${{ matrix.unityLicense }}
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
targetPlatform: ${{ matrix.targetPlatform }}
|
|
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
|
|
|
###########################
|
|
# Upload #
|
|
###########################
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: Build (${{ matrix.unityVersion }})
|
|
path: build
|
|
retention-days: 14
|
|
|
|
k8sBuilds:
|
|
name: K8s build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
targetPlatform:
|
|
- StandaloneLinux64
|
|
- StandaloneWindows64
|
|
unityLicense:
|
|
- ${{ secrets.UNITY_LICENSE }}
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- name: Checkout (default)
|
|
uses: actions/checkout@v2
|
|
if: github.event.event_type != 'pull_request_target'
|
|
with:
|
|
lfs: true
|
|
- name: Checkout (pull_request_target)
|
|
uses: actions/checkout@v2
|
|
if: github.event.event_type == 'pull_request_target'
|
|
with:
|
|
lfs: true
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
###########################
|
|
# Spin up #
|
|
###########################
|
|
- uses: GoogleCloudPlatform/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 }}
|
|
- run: ./action/bootstrapper/ApplyClusterAndAcquireLock.sh ${{ env.GKE_PROJECT }} ${{ env.GKE_CLUSTER }} ${{ env.GKE_ZONE }}
|
|
|
|
###########################
|
|
# Build #
|
|
###########################
|
|
- uses: frostebite/File-To-Base64@master
|
|
id: read-base64
|
|
with:
|
|
filePath: ~/.kube/config
|
|
- uses: ./
|
|
id: k8s-unity-build
|
|
env:
|
|
UNITY_LICENSE: ${{ matrix.unityLicense }}
|
|
with:
|
|
targetPlatform: ${{ matrix.targetPlatform }}
|
|
kubeConfig: ${{ steps.read-base64.outputs.base64 }}
|
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
projectPath: test-project
|
|
unityVersion: 2019.3.15f1
|
|
|
|
###########################
|
|
# Upload #
|
|
###########################
|
|
- uses: frostebite/K8s-Download-Volume@master
|
|
with:
|
|
kubeConfig: ${{ steps.read-base64.outputs.base64 }}
|
|
volume: ${{ steps.k8s-unity-build.outputs.volume }}
|
|
sourcePath: repo/build/
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: Kubernetes Build (${{ matrix.targetPlatform }})
|
|
path: k8s-volume-download
|
|
retention-days: 14
|
|
|
|
###########################
|
|
# Spin down #
|
|
###########################
|
|
- run: ./action/bootstrapper/ReleaseLockAndAttemptShutdown.sh ${{ env.GKE_PROJECT }} ${{ env.GKE_CLUSTER }} ${{ env.GKE_ZONE }}
|
|
if: ${{ always() }}
|