split workflows (#203)

This commit is contained in:
Webber Takken 2021-01-23 11:39:42 +01:00 committed by GitHub
parent 2cec591baa
commit c7c1841c97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 202 additions and 184 deletions

83
.github/workflows/build-tests.yml vendored Normal file
View File

@ -0,0 +1,83 @@
name: Builds
on:
push: { branches: [main] }
pull_request_target:
paths-ignore:
- '.github/**'
jobs:
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.
- WebGL # WebGL.
# - StandaloneWindows # Build a Windows standalone.
# - 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

View File

@ -1,13 +1,14 @@
name: Delete old artifacts name: Cleanup (cron)
on: on:
schedule: schedule:
- cron: '30 10 * * SUN' # every sunday at 10:30 - cron: '30 10 * * SUN' # every sunday at 10:30
jobs: jobs:
delete-artifacts: deleteArtifacts:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: kolpav/purge-artifacts-action@v1 - name: Delete old artifacts
uses: kolpav/purge-artifacts-action@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 21 days expire-in: 21 days

24
.github/workflows/integrity-check.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Integrity
on:
push: { branches: [main] }
pull_request: {}
env:
CODECOV_TOKEN: '2f2eb890-30e2-4724-83eb-7633832cf0de'
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; }

91
.github/workflows/kubernetes-tests.yml vendored Normal file
View File

@ -0,0 +1,91 @@
name: Kubernetes
on:
push: { branches: [main] }
pull_request_target:
paths-ignore:
- '.github/**'
env:
GKE_ZONE: 'us-central1-c'
GKE_REGION: 'us-central1'
GKE_PROJECT: 'unitykubernetesbuilder'
GKE_CLUSTER: 'unity-builder-cluster'
jobs:
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() }}

View File

@ -1,181 +0,0 @@
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() }}