mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-01-29 12:19:06 +08:00
Compare commits
80 Commits
check-inte
...
v2.0-alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e31af20466 | ||
|
|
a1f68ab26c | ||
|
|
e13a9f51e9 | ||
|
|
7e7938581c | ||
|
|
501c67e40c | ||
|
|
398eda622f | ||
|
|
8bd212e020 | ||
|
|
8419046c0f | ||
|
|
4d0b6e6db1 | ||
|
|
224f973562 | ||
|
|
b769675b38 | ||
|
|
4fde4e47b6 | ||
|
|
0934b3f408 | ||
|
|
414307a791 | ||
|
|
faefe2f8d7 | ||
|
|
b0df698630 | ||
|
|
0d3b5a7a62 | ||
|
|
555660c904 | ||
|
|
4fe037e06f | ||
|
|
05b7ccdc04 | ||
|
|
c7c1841c97 | ||
|
|
2cec591baa | ||
|
|
08e3347f47 | ||
|
|
89df68796c | ||
|
|
56b9864426 | ||
|
|
5b2e80e1a4 | ||
|
|
c8202c01e7 | ||
|
|
9f510401e2 | ||
|
|
32acb22fec | ||
|
|
602b0b45d7 | ||
|
|
9c804d98a0 | ||
|
|
042fb6ae32 | ||
|
|
df7d1e1e25 | ||
|
|
9707ad7ad5 | ||
|
|
8eeb848483 | ||
|
|
9e2a1b2d35 | ||
|
|
471bf0bdf0 | ||
|
|
6c2fbff839 | ||
|
|
17c28995b2 | ||
|
|
72ab50499d | ||
|
|
9269fba307 | ||
|
|
dc54ae10a5 | ||
|
|
5417369dba | ||
|
|
21c985b8e9 | ||
|
|
483b784253 | ||
|
|
e6d3daedbe | ||
|
|
046ab3a72d | ||
|
|
ec0baa5d7b | ||
|
|
5b8f3cf342 | ||
|
|
ef74241772 | ||
|
|
3d7e4a8018 | ||
|
|
91da660786 | ||
|
|
f42f7923ed | ||
|
|
22bc9a9bad | ||
|
|
6a53a9e853 | ||
|
|
cccd5074ea | ||
|
|
977683cd5f | ||
|
|
89bdaa5e46 | ||
|
|
24e9c186fd | ||
|
|
92cfb31622 | ||
|
|
67b76584b8 | ||
|
|
3ee15170fd | ||
|
|
3e0842dda0 | ||
|
|
1f8d196ed0 | ||
|
|
e003f9e2ca | ||
|
|
21634107c1 | ||
|
|
196fe8fc5b | ||
|
|
ec0cde0c85 | ||
|
|
72ff2983a1 | ||
|
|
fdf71758a9 | ||
|
|
91ec427695 | ||
|
|
6fb8550919 | ||
|
|
cb913cd286 | ||
|
|
96eeaf940a | ||
|
|
6ece6447b2 | ||
|
|
3523c6a934 | ||
|
|
bf702784d2 | ||
|
|
bdc3a88d22 | ||
|
|
401ddcaae0 | ||
|
|
1245bfefc8 |
@@ -2,4 +2,4 @@
|
|||||||
*
|
*
|
||||||
|
|
||||||
# Files required for the action
|
# Files required for the action
|
||||||
!action/
|
!dist/
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ end_of_line = lf
|
|||||||
indent_size = 2
|
indent_size = 2
|
||||||
indent_style = space
|
indent_style = space
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
max_line_length = 100
|
max_line_length = 120
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
**/node_modules/**
|
dist/
|
||||||
**/action/**
|
lib/
|
||||||
|
node_modules/
|
||||||
|
jest.config.js
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
{
|
{
|
||||||
"parser": "babel-eslint",
|
"plugins": ["jest", "@typescript-eslint", "prettier", "unicorn"],
|
||||||
|
"extends": ["plugin:unicorn/recommended", "plugin:github/recommended", "prettier"],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 9,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"jest": true
|
"jest/globals": true
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2020,
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"impliedStrict": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extends": ["airbnb", "plugin:unicorn/recommended", "prettier"],
|
|
||||||
"plugins": ["react", "jsx-a11y", "import", "prettier", "flowtype", "unicorn"],
|
|
||||||
"settings": { "react": { "version": "latest" } },
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"prettier/prettier": "error",
|
"prettier/prettier": "error",
|
||||||
"import/no-extraneous-dependencies": 0
|
"import/no-extraneous-dependencies": 0,
|
||||||
|
"import/no-namespace": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
dist/index* -diff linguist-generated=true
|
||||||
|
dist/licenses* -diff linguist-generated=true
|
||||||
|
dist/sourcemap* -diff linguist-generated=true
|
||||||
25
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
**Bug description**
|
||||||
|
|
||||||
|
<!--A clear and concise description of what the bug is.-->
|
||||||
|
|
||||||
|
**How to reproduce**
|
||||||
|
|
||||||
|
<!--Steps to reproduce the behavior:-->
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
|
||||||
|
<!--A clear and concise description of what you expected to happen.-->
|
||||||
|
|
||||||
|
**Additional details**
|
||||||
|
|
||||||
|
<!--Please add context, links, reasons, screenshots, etc.-->
|
||||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: Discuss on Discord
|
||||||
|
url: https://game.ci/discord
|
||||||
|
about: Join our Discord community
|
||||||
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an improvement or now feature
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
**Context**
|
||||||
|
|
||||||
|
<!--Please describe a proper context-->
|
||||||
|
|
||||||
|
**Suggested solution**
|
||||||
|
|
||||||
|
<!--Tell us what you would suggest-->
|
||||||
|
|
||||||
|
**Considered alternatives**
|
||||||
|
|
||||||
|
<!--Please add any alternative solutions that you have considered-->
|
||||||
|
|
||||||
|
**Additional details**
|
||||||
|
|
||||||
|
<!--Please add context, links, reasons, screenshots, etc.-->
|
||||||
7
.github/ISSUE_TEMPLATE/other.md
vendored
Normal file
7
.github/ISSUE_TEMPLATE/other.md
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
name: Other
|
||||||
|
about: Everything else
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
11
.github/pull_request_template.md
vendored
Normal file
11
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#### Changes
|
||||||
|
|
||||||
|
- ...
|
||||||
|
|
||||||
|
#### Checklist
|
||||||
|
|
||||||
|
<!-- please check all items and add your own -->
|
||||||
|
|
||||||
|
- [x] Read the contribution [guide](../CONTRIBUTING.md) and accept the [code](../CODE_OF_CONDUCT.md) of conduct
|
||||||
|
- [ ] Readme (updated or not needed)
|
||||||
|
- [ ] Tests (added, updated or not needed)
|
||||||
49
.github/workflows/activation.yml
vendored
49
.github/workflows/activation.yml
vendored
@@ -1,29 +1,20 @@
|
|||||||
#name: Acquire activation file
|
name: Acquire activation file
|
||||||
#
|
|
||||||
#on: [push]
|
on:
|
||||||
#
|
workflow_dispatch:
|
||||||
#jobs:
|
|
||||||
# activation:
|
jobs:
|
||||||
# name: Request manual activation file (${{ matrix.unityVersion }}) 🔑
|
activation:
|
||||||
# runs-on: ubuntu-latest
|
name: Request manual activation file 🔑
|
||||||
# strategy:
|
runs-on: ubuntu-latest
|
||||||
# fail-fast: false
|
steps:
|
||||||
# matrix:
|
# Request manual activation file
|
||||||
# unityVersion:
|
- name: Unity - Request Activation File
|
||||||
# - 2019.2.11f1
|
id: requestActivationFile
|
||||||
# - 2019.3.15f1
|
uses: game-ci/unity-request-activation-file@v2.0-alpha-1
|
||||||
#
|
- name: Upload activation file
|
||||||
# steps:
|
uses: actions/upload-artifact@v2
|
||||||
# # Request manual activation file
|
with:
|
||||||
# - name: Request manual activation file
|
name: ${{ steps.requestActivationFile.outputs.filePath }}
|
||||||
# id: getManualLicenseFile
|
path: ${{ steps.requestActivationFile.outputs.filePath }}
|
||||||
# uses: webbertakken/unity-request-manual-activation-file@v1.1
|
retention-days: 3
|
||||||
# with:
|
|
||||||
# unityVersion: ${{ matrix.unityVersion }}
|
|
||||||
#
|
|
||||||
# # Upload artifact (Unity_v20XX.X.XXXX.alf)
|
|
||||||
# - name: Expose as artifact
|
|
||||||
# uses: actions/upload-artifact@v1
|
|
||||||
# with:
|
|
||||||
# name: ${{ steps.getManualLicenseFile.outputs.filePath }}
|
|
||||||
# path: ${{ steps.getManualLicenseFile.outputs.filePath }}
|
|
||||||
|
|||||||
60
.github/workflows/aws-tests.yml
vendored
Normal file
60
.github/workflows/aws-tests.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
name: AWS
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: { branches: [aws, aws-ts-clean] }
|
||||||
|
|
||||||
|
env:
|
||||||
|
AWS_REGION: "eu-west-1"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
buildForAllPlatforms:
|
||||||
|
name: AWS Fargate Build
|
||||||
|
if: github.event.pull_request.draft == false
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
projectPath:
|
||||||
|
- test-project
|
||||||
|
unityVersion:
|
||||||
|
# - 2019.2.11f1
|
||||||
|
- 2019.3.15f1
|
||||||
|
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
|
||||||
|
steps:
|
||||||
|
- name: Checkout (default)
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
if: github.event.event_type != 'pull_request_target'
|
||||||
|
with:
|
||||||
|
lfs: true
|
||||||
|
- 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: eu-west-2
|
||||||
|
- uses: ./
|
||||||
|
id: aws-fargate-unity-build
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_DEFAULT_REGION: eu-west-2
|
||||||
|
with:
|
||||||
|
remoteBuildCluster: aws
|
||||||
|
projectPath: ${{ matrix.projectPath }}
|
||||||
|
unityVersion: ${{ matrix.unityVersion }}
|
||||||
|
targetPlatform: ${{ matrix.targetPlatform }}
|
||||||
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
73
.github/workflows/build-tests.yml
vendored
Normal file
73
.github/workflows/build-tests.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
name: Builds
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: { branches: [main] }
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '.github/**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
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:
|
||||||
|
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
|
||||||
|
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 #
|
||||||
|
###########################
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
lfs: true
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Cache #
|
||||||
|
###########################
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ matrix.projectPath }}/Library
|
||||||
|
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
||||||
|
restore-keys: |
|
||||||
|
Library-${{ matrix.projectPath }}-
|
||||||
|
Library-
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Build #
|
||||||
|
###########################
|
||||||
|
- uses: ./
|
||||||
|
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
|
||||||
16
.github/workflows/cats.yml
vendored
Normal file
16
.github/workflows/cats.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: Cats 😺
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
aCatForCreatingThePullRequest:
|
||||||
|
name: A cat for your effort!
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: ruairidhwm/action-cats@1.0.1
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
14
.github/workflows/cleanup.yml
vendored
Normal file
14
.github/workflows/cleanup.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: Cleanup (cron)
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '30 10 * * SUN' # every sunday at 10:30
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deleteArtifacts:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Delete old artifacts
|
||||||
|
uses: kolpav/purge-artifacts-action@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
expire-in: 21 days
|
||||||
24
.github/workflows/integrity-check.yml
vendored
Normal file
24
.github/workflows/integrity-check.yml
vendored
Normal 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 dist || { echo "dist should be auto generated" ; git diff dist ; exit 62; }
|
||||||
80
.github/workflows/kubernetes-tests.yml
vendored
Normal file
80
.github/workflows/kubernetes-tests.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
name: Kubernetes
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
# push: { branches: [main] }
|
||||||
|
# pull_request:
|
||||||
|
# paths-ignore:
|
||||||
|
# - '.github/**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
GKE_ZONE: 'us-central1-c'
|
||||||
|
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 build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
targetPlatform:
|
||||||
|
- StandaloneLinux64
|
||||||
|
- StandaloneWindows64
|
||||||
|
steps:
|
||||||
|
###########################
|
||||||
|
# Checkout #
|
||||||
|
###########################
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
lfs: true
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# 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: ./dist/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
|
||||||
|
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: ./dist/bootstrapper/ReleaseLockAndAttemptShutdown.sh ${{ env.GKE_PROJECT }} ${{ env.GKE_CLUSTER }} ${{ env.GKE_ZONE }}
|
||||||
|
if: ${{ always() }}
|
||||||
81
.github/workflows/main.yml
vendored
81
.github/workflows/main.yml
vendored
@@ -1,81 +0,0 @@
|
|||||||
name: Actions 😎
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request: {}
|
|
||||||
push: { branches: [master] }
|
|
||||||
|
|
||||||
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@v1
|
|
||||||
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
|
|
||||||
include:
|
|
||||||
# Please be polite; don't copy my personal licenses.
|
|
||||||
# These are here because they are needed to allowing pull requests from forks to unity-builder.
|
|
||||||
# You should be using ${{ secrets.UNITY_LICENSE_2019_3_15 }} here.
|
|
||||||
- unityVersion: 2019.2.11f1
|
|
||||||
license: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"d39b8e2f4d364b2e98b06afa0c6e08c5\"/>\n <Binding Key=\"2\" Value=\"d39b8e2f4d364b2e98b06afa0c6e08c5\"/>\n </MachineBindings>\n <MachineID Value=\"Xxo1ZKbdPu/IATrc0mPBYANJFF0=\"/>\n <SerialHash Value=\"1efd68fa935192b6090ac03c77d289a9f588c55a\"/>\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=\"AQAAAEY0LUg2WFMtUE00NS1SM0M4LUUyWlotWkdWOA==\"/>\n <SerialMasked Value=\"F4-H6XS-PM45-R3C8-E2ZZ-XXXX\"/>\n <StartDate Value=\"2018-05-02T00:00:00\"/>\n <UpdateDate Value=\"2019-11-25T18:23:38\"/>\n <InitialActivationDate Value=\"2018-05-02T14:21:28\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2019.2.11f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" 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>JHdOBFmBNq2H8BrGFzir/StLoYo=</DigestValue></Reference></SignedInfo><SignatureValue>aENLHd37a51RtP2/g7YU0Pexf5mx0/ENXYGtrPzqwZ8NQt2AsSdxGnl0CUB45/GuNXfJVDt2HWot\ncNYZB2OylVBn1WHQbKZlPmm8gEAMz0MYbr4Isb5i5buryBrZlmbEOjnRI+pEg1CBwlgMo6xdtjjE\n/d7cC293QIUO91kdzRXftYou1dNaUyuPL9ZH65vdB2pDXGRNxgUVD+GnnqZA7b5L2HXqNQclcWAK\n5Yd1BeF3VzR1iLw9G/SmH5oOhnpXSmqbL4qk7LVP2/mgXpFk5kP4X8VC3z47obNhBIGq40dwWyEe\nUYk5/nRAOkZawDT+tcu96e06gPC9Cxk5PdbRbA==</SignatureValue></Signature></root>"
|
|
||||||
- unityVersion: 2019.3.15f1
|
|
||||||
license: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"33bf639e81e54693a8f9bf57c8900e5a\"/>\n <Binding Key=\"2\" Value=\"33bf639e81e54693a8f9bf57c8900e5a\"/>\n </MachineBindings>\n <MachineID Value=\"xWka2iXdDJejhZdi/zU2RUeXUi4=\"/>\n <SerialHash Value=\"1efd68fa935192b6090ac03c77d289a9f588c55a\"/>\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=\"AQAAAEY0LUg2WFMtUE00NS1SM0M4LUUyWlotWkdWOA==\"/>\n <SerialMasked Value=\"F4-H6XS-PM45-R3C8-E2ZZ-XXXX\"/>\n <StartDate Value=\"2018-05-02T00:00:00\"/>\n <UpdateDate Value=\"2020-06-14T13:49:47\"/>\n <InitialActivationDate Value=\"2018-05-02T14:21:28\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2019.3.15f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" 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>bpzWx3PZ0lqWDo1m9aLQuZ4cweo=</DigestValue></Reference></SignedInfo><SignatureValue>QcDm4/qAXZuUMQbUVk63vO6u66Bp8PnqqWQcZZOcym/rGUZLj1sr66EquF3X3w1L7aqiwMGtbY2b\nkPttcalFeaBkc5NsJMrexWjuBCxQvhbmVFQnTjvC6vNS+k1wrkz7If1oPkz/XaDtCfUs8oxc9iPe\nPzzUJIVYLZoDtpPq2XbgVn9/TiVb3Zu6ldKgvtNRYUjrB3KywtvL9OcIFll3htRcBZPG43kxryJc\nDD2TL5Nw1JuX6MejBBuYTZsZNpGX9Pjop9+uFUZ4GI9h8a5g6wJUfXzsGw7j4gkvDkC9MvyWiksi\n2hNXw1QNeB6JfQsd4sAuhYh/CqTm2gCz9i9ZpA==</SignatureValue></Signature></root>"
|
|
||||||
targetPlatform:
|
|
||||||
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
|
|
||||||
- StandaloneWindows # Build a Windows standalone.
|
|
||||||
- StandaloneWindows64 # Build a Windows 64-bit standalone.
|
|
||||||
- StandaloneLinux64 # Build a Linux 64-bit standalone.
|
|
||||||
- iOS # Build an iOS player.
|
|
||||||
# - Android # Build an Android .apk standalone app.
|
|
||||||
# - 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:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
lfs: true
|
|
||||||
- uses: actions/cache@v1.1.0
|
|
||||||
with:
|
|
||||||
path: ${{ matrix.projectPath }}/Library
|
|
||||||
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
||||||
restore-keys: |
|
|
||||||
Library-${{ matrix.projectPath }}-
|
|
||||||
Library-
|
|
||||||
- uses: ./
|
|
||||||
env:
|
|
||||||
UNITY_LICENSE: ${{ matrix.license }}
|
|
||||||
with:
|
|
||||||
projectPath: ${{ matrix.projectPath }}
|
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
|
||||||
targetPlatform: ${{ matrix.targetPlatform }}
|
|
||||||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
|
||||||
- uses: actions/upload-artifact@v1
|
|
||||||
with:
|
|
||||||
name: Build (${{ matrix.unityVersion }})
|
|
||||||
path: build
|
|
||||||
14
.github/workflows/versioning.yml
vendored
Normal file
14
.github/workflows/versioning.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: Versioning
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published, edited]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
updateMajorTag:
|
||||||
|
name: Update major tag
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: Actions-R-Us/actions-tagger@v2
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
.idea
|
.idea
|
||||||
node_modules
|
node_modules
|
||||||
coverage/
|
coverage/
|
||||||
|
lib/
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
**/node_modules/**
|
**/node_modules/**
|
||||||
**/action/**
|
**/dist/**
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "all",
|
"trailingComma": "all",
|
||||||
"printWidth": 100
|
"printWidth": 120
|
||||||
}
|
}
|
||||||
|
|||||||
2
.yarnrc
2
.yarnrc
@@ -1,3 +1,3 @@
|
|||||||
save-prefix ""
|
save-prefix "^"
|
||||||
--install.audit true
|
--install.audit true
|
||||||
--add.audit true
|
--add.audit true
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ When fixing a bug it is fine to submit a pull request right away.
|
|||||||
|
|
||||||
Steps to be performed to submit a pull request:
|
Steps to be performed to submit a pull request:
|
||||||
|
|
||||||
1. Fork the repository and create your branch from `master`.
|
1. Fork the repository and create your branch from `main`.
|
||||||
2. Run `yarn` in the repository root.
|
2. Run `yarn` in the repository root.
|
||||||
3. If you've fixed a bug or added code that should be tested, add tests!
|
3. If you've fixed a bug or added code that should be tested, add tests!
|
||||||
4. Fill out the description, link any related issues and submit your pull request.
|
4. Fill out the description, link any related issues and submit your pull request.
|
||||||
|
|||||||
345
README.md
345
README.md
@@ -1,340 +1,45 @@
|
|||||||
# Unity - Builder
|
# Unity - Builder
|
||||||
|
|
||||||
[](https://github.com/webbertakken/unity-builder/actions?query=branch%3Amaster+event%3Apush+workflow%3A%22Actions+%F0%9F%98%8E%22)
|
(Not affiliated with Unity Technologies)
|
||||||
[](https://lgtm.com/projects/g/webbertakken/unity-builder/context:javascript)
|
|
||||||
[](https://codecov.io/gh/webbertakken/unity-builder)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
GitHub Action to
|
GitHub Action to
|
||||||
[build Unity projects](https://github.com/marketplace/actions/unity-builder)
|
[build Unity projects](https://github.com/marketplace/actions/unity-builder)
|
||||||
for different platforms.
|
for different platforms.
|
||||||
|
|
||||||
Part of the
|
Part of the <a href="https://game.ci">GameCI</a> open source project.
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
<br />
|
||||||
collection.
|
<br />
|
||||||
|
|
||||||
---
|
[](https://github.com/game-ci/unity-builder/actions?query=branch%3Amain+event%3Apush+workflow%3A%22Builds)
|
||||||
|
[](https://lgtm.com/projects/g/webbertakken/unity-builder/context:javascript)
|
||||||
|
[](https://codecov.io/gh/game-ci/unity-builder)
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
[Github Action](https://github.com/features/actions)
|
## How to use
|
||||||
to build Unity projects for different platforms.
|
|
||||||
|
|
||||||
It is recommended to run the
|
Find the
|
||||||
[Test](https://github.com/webbertakken/unity-actions#test)
|
[docs](https://game.ci/docs/github/builder)
|
||||||
action from the
|
on the GameCI
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
[documentation website](https://game.ci/docs).
|
||||||
collection before running this action. This action also requires the [Activation](https://github.com/marketplace/actions/unity-activate) step.
|
|
||||||
|
|
||||||
## Documentation
|
## Related actions
|
||||||
|
|
||||||
See the
|
Visit the
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
GameCI <a href="https://github.com/game-ci/unity-actions">Unity Actions</a>
|
||||||
collection repository for workflow documentation and reference implementation.
|
status repository for related Actions.
|
||||||
|
|
||||||
## Usage
|
## Community
|
||||||
|
|
||||||
#### Setup builder
|
Feel free to join us on
|
||||||
|
<a href="http://game.ci/discord"><img height="30" src="media/Discord-Logo.svg" alt="Discord" /></a>
|
||||||
|
and engage with the community.
|
||||||
|
|
||||||
By default the enabled scenes from the project's settings will be built.
|
## Contributing
|
||||||
|
|
||||||
Create or edit the file called `.github/workflows/main.yml` and add a job to it.
|
To help improve the documentation, please find the docs [repository](https://github.com/game-ci/documentation).
|
||||||
|
|
||||||
##### Personal License
|
To contribute to Unity Builder, kindly read the [contribution guide](./CONTRIBUTING.md).
|
||||||
|
|
||||||
Personal licenses require a one-time manual activation step (per unity version).
|
|
||||||
|
|
||||||
Make sure you
|
|
||||||
[acquire and activate](https://github.com/marketplace/actions/unity-request-activation-file)
|
|
||||||
your license file and add it as a secret.
|
|
||||||
|
|
||||||
Then, define the build step as follows:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
env:
|
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
with:
|
|
||||||
projectPath: path/to/your/project
|
|
||||||
unityVersion: 2020.X.XXXX
|
|
||||||
targetPlatform: WebGL
|
|
||||||
```
|
|
||||||
|
|
||||||
##### Professional license
|
|
||||||
|
|
||||||
Professional licenses do not need any manual steps.
|
|
||||||
|
|
||||||
Instead, three variables will need to be set.
|
|
||||||
|
|
||||||
- `UNITY_EMAIL` (should contain the email address for your Unity account)
|
|
||||||
- `UNITY_PASSWORD` (the password that you use to login to Unity)
|
|
||||||
- `UNITY_SERIAL` (the serial provided by Unity)
|
|
||||||
|
|
||||||
Define the build step as follows:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
env:
|
|
||||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
||||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
||||||
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
|
|
||||||
with:
|
|
||||||
projectPath: path/to/your/project
|
|
||||||
unityVersion: 2020.X.XXXX
|
|
||||||
targetPlatform: WebGL
|
|
||||||
```
|
|
||||||
|
|
||||||
That is all you need to build your project.
|
|
||||||
|
|
||||||
#### Storing the build
|
|
||||||
|
|
||||||
To be able to access your built files,
|
|
||||||
they need to be uploaded as artifacts.
|
|
||||||
To do this it is recommended to use Github Actions official
|
|
||||||
[upload artifact action](https://github.com/marketplace/actions/upload-artifact)
|
|
||||||
after any build action.
|
|
||||||
|
|
||||||
By default, Builder outputs it's builds to a folder named `build`.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: actions/upload-artifact@v1
|
|
||||||
with:
|
|
||||||
name: Build
|
|
||||||
path: build
|
|
||||||
```
|
|
||||||
|
|
||||||
Builds can now be downloaded as Artifacts in the Actions tab.
|
|
||||||
|
|
||||||
#### Caching
|
|
||||||
|
|
||||||
In order to make builds run faster, you can cache Library files from previous
|
|
||||||
builds. To do so simply add Github Actions official
|
|
||||||
[cache action](https://github.com/marketplace/actions/cache) before any unity steps.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: actions/cache@v1.1.0
|
|
||||||
with:
|
|
||||||
path: path/to/your/project/Library
|
|
||||||
key: Library-MyProjectName-TargetPlatform
|
|
||||||
restore-keys: |
|
|
||||||
Library-MyProjectName-
|
|
||||||
Library-
|
|
||||||
```
|
|
||||||
|
|
||||||
This simple addition could speed up your build by more than 50%.
|
|
||||||
|
|
||||||
## Complete example
|
|
||||||
|
|
||||||
A complete workflow that builds every available platform could look like this:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: Build project
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request: {}
|
|
||||||
push: { branches: [master] }
|
|
||||||
|
|
||||||
env:
|
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildForSomePlatforms:
|
|
||||||
name: Build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
projectPath:
|
|
||||||
- path/to/your/project
|
|
||||||
unityVersion:
|
|
||||||
- 2019.2.11f1
|
|
||||||
- 2019.3.0f1
|
|
||||||
targetPlatform:
|
|
||||||
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
|
|
||||||
- StandaloneWindows # Build a Windows standalone.
|
|
||||||
- StandaloneWindows64 # Build a Windows 64-bit standalone.
|
|
||||||
- StandaloneLinux64 # Build a Linux 64-bit standalone.
|
|
||||||
- iOS # Build an iOS player.
|
|
||||||
- Android # Build an Android .apk standalone app.
|
|
||||||
- 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:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
lfs: true
|
|
||||||
- uses: actions/cache@v1.1.0
|
|
||||||
with:
|
|
||||||
path: ${{ matrix.projectPath }}/Library
|
|
||||||
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
||||||
restore-keys: |
|
|
||||||
Library-${{ matrix.projectPath }}-
|
|
||||||
Library-
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
projectPath: ${{ matrix.projectPath }}
|
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
|
||||||
targetPlatform: ${{ matrix.targetPlatform }}
|
|
||||||
- uses: actions/upload-artifact@v1
|
|
||||||
with:
|
|
||||||
name: Build
|
|
||||||
path: build
|
|
||||||
```
|
|
||||||
|
|
||||||
> **Note:** _Environment variables are set for all jobs in the workflow like this._
|
|
||||||
|
|
||||||
## Configuration options
|
|
||||||
|
|
||||||
Below options can be specified under `with:` for the `unity-builder` action.
|
|
||||||
|
|
||||||
#### projectPath
|
|
||||||
|
|
||||||
Specify the path to your Unity project to be built.
|
|
||||||
The path should be relative to the root of your project.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `<your project root>`_
|
|
||||||
|
|
||||||
#### unityVersion
|
|
||||||
|
|
||||||
Version of Unity to use for building the project.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `2019.2.1f11`_
|
|
||||||
|
|
||||||
#### targetPlatform
|
|
||||||
|
|
||||||
Platform that the build should target.
|
|
||||||
|
|
||||||
Must be one of the [allowed values](https://docs.unity3d.com/ScriptReference/BuildTarget.html) listed in the Unity scripting manual.
|
|
||||||
|
|
||||||
_**required:** `true`_
|
|
||||||
|
|
||||||
#### buildName
|
|
||||||
|
|
||||||
Name of the build. Also the folder in which the build will be stored within `buildsPath`.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `<build_target>`_
|
|
||||||
|
|
||||||
#### buildsPath
|
|
||||||
|
|
||||||
Path where the builds should be stored.
|
|
||||||
|
|
||||||
In this folder a folder will be created for every targetPlatform.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `build`_
|
|
||||||
|
|
||||||
#### buildMethod
|
|
||||||
|
|
||||||
Custom command to run your build.
|
|
||||||
|
|
||||||
There are two conditions for a custom buildCommand:
|
|
||||||
|
|
||||||
- Must reference a valid path to a `static` method.
|
|
||||||
- The class must reside in the `Assets/Editor` directory.
|
|
||||||
|
|
||||||
_**example:**_
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
buildMethod: EditorNamespace.BuilderClassName.StaticBulidMethod
|
|
||||||
```
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** Built-in script that will run a build out of the box._
|
|
||||||
|
|
||||||
#### versioning
|
|
||||||
|
|
||||||
Configure a specific versioning strategy
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
versioning: Semantic
|
|
||||||
```
|
|
||||||
|
|
||||||
Find the available strategies below:
|
|
||||||
|
|
||||||
##### Semantic
|
|
||||||
|
|
||||||
Versioning out of the box! **(recommended)**
|
|
||||||
|
|
||||||
> Compatible with **all platforms**.
|
|
||||||
> Does **not** modify your repository.
|
|
||||||
> Requires **zero configuration**.
|
|
||||||
|
|
||||||
How it works:
|
|
||||||
|
|
||||||
> Generates a version based on [semantic versioning](https://semver.org/).
|
|
||||||
> Follows `<major>.<minor>.<patch>` for example `0.17.2`.
|
|
||||||
> The latest tag dictates `<major>.<minor>` (defaults to 0.0 for no tag).
|
|
||||||
> The number of commits (since the last tag, if any) is used for `<patch>`.
|
|
||||||
|
|
||||||
No configuration required.
|
|
||||||
|
|
||||||
##### Custom
|
|
||||||
|
|
||||||
Allows specifying a custom version in the `version` field. **(advanced users)**
|
|
||||||
|
|
||||||
> This strategy is useful when your project or pipeline has some kind of orchestration
|
|
||||||
> that determines the versions.
|
|
||||||
|
|
||||||
##### None
|
|
||||||
|
|
||||||
No version will be set by Builder. **(not recommended)**
|
|
||||||
|
|
||||||
> Not recommended unless you generate a new version in a pre-commit hook. Manually
|
|
||||||
> setting versions is error-prone.
|
|
||||||
|
|
||||||
#### allowDirtyBuild
|
|
||||||
|
|
||||||
Allows the branch of the build to be dirty, and still generate the build.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
allowDirtyBuild: true
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that it is generally bad practice to modify your branch
|
|
||||||
in a CI Pipeline. However there are exceptions where this might
|
|
||||||
be needed. (use with care).
|
|
||||||
|
|
||||||
#### customParameters
|
|
||||||
|
|
||||||
Custom parameters to configure the build.
|
|
||||||
|
|
||||||
Parameters must start with a hyphen (`-`) and may be followed by a value (without hyphen).
|
|
||||||
|
|
||||||
Parameters without a value will be considered booleans (with a value of true).
|
|
||||||
|
|
||||||
_**example:**_
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
|
||||||
```
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** ""_
|
|
||||||
|
|
||||||
## More actions
|
|
||||||
|
|
||||||
Visit
|
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
|
||||||
to find related actions for Unity.
|
|
||||||
|
|
||||||
Feel free to contribute.
|
|
||||||
|
|
||||||
## Licence
|
## Licence
|
||||||
|
|
||||||
|
|||||||
103
action.yml
103
action.yml
@@ -3,9 +3,13 @@ author: Webber Takken <webber@takken.io>
|
|||||||
description: 'Build Unity projects for different platforms.'
|
description: 'Build Unity projects for different platforms.'
|
||||||
inputs:
|
inputs:
|
||||||
unityVersion:
|
unityVersion:
|
||||||
|
required: false
|
||||||
|
default: 'auto'
|
||||||
|
description: 'Version of unity to use for building the project. Use "auto" to get from your ProjectSettings/ProjectVersion.txt'
|
||||||
|
customImage:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description: 'Version of unity to use for building the project.'
|
description: 'Specific docker image that should be used for building the project'
|
||||||
targetPlatform:
|
targetPlatform:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
@@ -26,10 +30,103 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.'
|
description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.'
|
||||||
outputs: {}
|
remoteBuildCluster:
|
||||||
|
default: 'local'
|
||||||
|
required: false
|
||||||
|
description: 'Either local, k8s or aws can be used to run builds on a remote cluster. Additional parameters must be configured.'
|
||||||
|
awsStackName:
|
||||||
|
default: 'game-ci'
|
||||||
|
required: false
|
||||||
|
description: 'The Cloud Formation stack name that must be setup before using this option.'
|
||||||
|
kubeConfig:
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
description: 'Supply a base64 encoded kubernetes config to run builds on kubernetes and stream logs until completion.'
|
||||||
|
kubeVolume:
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
description: 'Supply a Persistent Volume Claim name to use for the Unity build.'
|
||||||
|
remoteBuildMemory:
|
||||||
|
default: '800M'
|
||||||
|
required: false
|
||||||
|
description: 'Amount of memory to assign the remote build container'
|
||||||
|
remoteBuildCpu:
|
||||||
|
default: '0.25'
|
||||||
|
required: false
|
||||||
|
description: 'Amount of CPU time to assign the remote build container'
|
||||||
|
kubeVolumeSize:
|
||||||
|
default: '5Gi'
|
||||||
|
required: false
|
||||||
|
description: 'Amount of disc space to assign the Kubernetes Persistent Volume'
|
||||||
|
githubToken:
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
description: 'GitHub token for cloning, only needed when kubeconfig is used.'
|
||||||
|
versioning:
|
||||||
|
required: false
|
||||||
|
default: 'Semantic'
|
||||||
|
description: 'The versioning scheme to use when building the project'
|
||||||
|
version:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'The version, when used with the "Custom" versioning scheme'
|
||||||
|
androidVersionCode:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'The android versionCode'
|
||||||
|
androidAppBundle:
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
description: 'Whether to build .aab instead of .apk'
|
||||||
|
androidKeystoreName:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'The android keystoreName'
|
||||||
|
androidKeystoreBase64:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'The base64 contents of the android keystore file'
|
||||||
|
androidKeystorePass:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'The android keystorePass'
|
||||||
|
androidKeyaliasName:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'The android keyaliasName'
|
||||||
|
androidKeyaliasPass:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'The android keyaliasPass'
|
||||||
|
customParameters:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: >
|
||||||
|
Custom parameters to configure the build.
|
||||||
|
|
||||||
|
Parameters must start with a hyphen (-) and may be followed by a value (without hyphen).
|
||||||
|
Parameters without a value will be considered booleans (with a value of true).
|
||||||
|
chownFilesTo:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'User and optionally group (user or user:group or uid:gid) to give ownership of the resulting build artifacts'
|
||||||
|
allowDirtyBuild:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: >
|
||||||
|
Allows the branch of the build to be dirty, and still generate the build.
|
||||||
|
|
||||||
|
Note that it is generally bad practice to modify your branch
|
||||||
|
in a CI Pipeline. However there are exceptions where this might
|
||||||
|
be needed. (use with care).
|
||||||
|
outputs:
|
||||||
|
volume:
|
||||||
|
description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes'
|
||||||
|
buildVersion:
|
||||||
|
description: 'The generated version used for the Unity build'
|
||||||
branding:
|
branding:
|
||||||
icon: 'box'
|
icon: 'box'
|
||||||
color: 'gray-dark'
|
color: 'gray-dark'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'action/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using UnityBuilderAction.Input;
|
|
||||||
using UnityBuilderAction.Reporting;
|
|
||||||
using UnityBuilderAction.Versioning;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEditor.Build.Reporting;
|
|
||||||
|
|
||||||
namespace UnityBuilderAction
|
|
||||||
{
|
|
||||||
static class Builder
|
|
||||||
{
|
|
||||||
public static void BuildProject()
|
|
||||||
{
|
|
||||||
// Gather values from args
|
|
||||||
var options = ArgumentsParser.GetValidatedOptions();
|
|
||||||
|
|
||||||
// Gather values from project
|
|
||||||
var scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(s => s.path).ToArray();
|
|
||||||
|
|
||||||
// Define BuildPlayer Options
|
|
||||||
var buildOptions = new BuildPlayerOptions {
|
|
||||||
scenes = scenes,
|
|
||||||
locationPathName = options["customBuildPath"],
|
|
||||||
target = (BuildTarget) Enum.Parse(typeof(BuildTarget), options["buildTarget"]),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set version for this build
|
|
||||||
VersionApplicator.SetVersion(options["version"]);
|
|
||||||
|
|
||||||
// Perform build
|
|
||||||
BuildReport buildReport = BuildPipeline.BuildPlayer(buildOptions);
|
|
||||||
|
|
||||||
// Summary
|
|
||||||
BuildSummary summary = buildReport.summary;
|
|
||||||
StdOutReporter.ReportSummary(summary);
|
|
||||||
|
|
||||||
// Result
|
|
||||||
BuildResult result = summary.result;
|
|
||||||
StdOutReporter.ExitWithResult(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run steps
|
|
||||||
#
|
|
||||||
|
|
||||||
source /steps/activate.sh
|
|
||||||
source /steps/build.sh
|
|
||||||
source /steps/return_license.sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Exit with code from the build step.
|
|
||||||
#
|
|
||||||
|
|
||||||
exit $BUILD_EXIT_CODE
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if [[ -n "$UNITY_SERIAL" ]]; then
|
|
||||||
#
|
|
||||||
# PROFESSIONAL (SERIAL) LICENSE MODE
|
|
||||||
#
|
|
||||||
# This will return the license that is currently in use.
|
|
||||||
#
|
|
||||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
|
||||||
/opt/Unity/Editor/Unity \
|
|
||||||
-batchmode \
|
|
||||||
-nographics \
|
|
||||||
-logFile /dev/stdout \
|
|
||||||
-quit \
|
|
||||||
-returnlicense
|
|
||||||
fi
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
const esModules = ['lodash-es'].join('|');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
ignore: [`/node_modules/(?!${esModules})`],
|
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
'@babel/preset-env',
|
|
||||||
{
|
|
||||||
targets: {
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
};
|
|
||||||
2
action/Dockerfile → dist/Dockerfile
vendored
2
action/Dockerfile → dist/Dockerfile
vendored
@@ -15,4 +15,6 @@ ADD steps /steps
|
|||||||
RUN chmod -R +x /steps
|
RUN chmod -R +x /steps
|
||||||
ADD entrypoint.sh /entrypoint.sh
|
ADD entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
RUN ls
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
69
dist/bootstrapper/ApplyClusterAndAcquireLock.sh
vendored
Executable file
69
dist/bootstrapper/ApplyClusterAndAcquireLock.sh
vendored
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This creates a GKE Cluster
|
||||||
|
# - Will wait for any deletion to complete on a cluster with the same name before creating
|
||||||
|
# - Will wait for completion before continuing
|
||||||
|
# - If the script is run concurrently multiple times, only one cluster will be created, all instances will wait for availability
|
||||||
|
# Requires GCP Cloud SDK
|
||||||
|
# Installs retry https://github.com/kadwanev/retry
|
||||||
|
|
||||||
|
GKE_PROJECT=$1
|
||||||
|
GKE_CLUSTER=$2
|
||||||
|
GKE_ZONE=$3
|
||||||
|
|
||||||
|
# may update this to avoid repeated install, drop me a comment if needed
|
||||||
|
sudo sh -c "curl https://raw.githubusercontent.com/kadwanev/retry/master/retry -o /usr/local/bin/retry && chmod +x /usr/local/bin/retry"
|
||||||
|
|
||||||
|
attempts=0
|
||||||
|
while [ $attempts -le 1 ]
|
||||||
|
do
|
||||||
|
retry -s 15 -t 20 -v '
|
||||||
|
STATUS=$(gcloud container clusters list --format="json" --project $GKE_PROJECT |
|
||||||
|
jq "
|
||||||
|
.[] |
|
||||||
|
{name: .name, status: .status} |
|
||||||
|
select(.name == \"$GKE_CLUSTER\")
|
||||||
|
" |
|
||||||
|
jq ".status")
|
||||||
|
if [ "$STATUS" == "\"STOPPING\"" ]; then echo "Cluster stopping waiting for completion" && exit 1; fi
|
||||||
|
exit 0
|
||||||
|
'
|
||||||
|
cluster=$(gcloud container clusters list --project $GKE_PROJECT --format="json" | jq '.[] | select(.name == "${GKE_CLUSTER}")')
|
||||||
|
|
||||||
|
if [ -z "$cluster" ];
|
||||||
|
then
|
||||||
|
echo "No clusters found for \"$GKE_CLUSTER\" in project \"$GKE_CLUSTER\" in zone \"$GKE_ZONE\""
|
||||||
|
# you may not need this, it installs GCP beta for additional command line options
|
||||||
|
gcloud components install beta -q
|
||||||
|
# replace this line with whatever type of cluster you want to create
|
||||||
|
gcloud beta container --project $GKE_PROJECT clusters create $GKE_CLUSTER --zone $GKE_ZONE --no-enable-basic-auth --cluster-version "1.15.12-gke.2" --machine-type "custom-1-3072" --image-type "COS" --disk-type "pd-standard" --disk-size "15" --metadata disable-legacy-endpoints=true --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "1" --enable-stackdriver-kubernetes --enable-ip-alias --default-max-pods-per-node "110" --enable-autoscaling --min-nodes "0" --max-nodes "3" --no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing --enable-autoupgrade --enable-autorepair --max-surge-upgrade 1 --max-unavailable-upgrade 0
|
||||||
|
fi;
|
||||||
|
retry -s 15 -t 20 -v '
|
||||||
|
STATUS=$(gcloud container clusters list --format="json" --project $GKE_PROJECT |
|
||||||
|
jq "
|
||||||
|
.[] |
|
||||||
|
{name: .name, status: .status} |
|
||||||
|
select(.name == \"$GKE_CLUSTER\")
|
||||||
|
" |
|
||||||
|
jq ".status")
|
||||||
|
if [ "$STATUS" == "\"PROVISIONING\"" ]; then echo "Cluster provisioning waiting for available" && exit 1; fi
|
||||||
|
exit 0
|
||||||
|
'
|
||||||
|
echo "Cluster is available"
|
||||||
|
gcloud container clusters get-credentials $GKE_CLUSTER --zone $GKE_ZONE --project $GKE_PROJECT
|
||||||
|
kubectl version
|
||||||
|
NSID=$(cat /proc/sys/kernel/random/uuid)
|
||||||
|
echo "::set-env name=NSID::"$NSID
|
||||||
|
{
|
||||||
|
cat <<EOF | kubectl apply -f -
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: ns-unity-builder-$NSID
|
||||||
|
labels:
|
||||||
|
app: unity-builder
|
||||||
|
EOF
|
||||||
|
} && exit 0
|
||||||
|
|
||||||
|
attempts=$(($attempts+1))
|
||||||
|
done
|
||||||
13
dist/bootstrapper/ReleaseLockAndAttemptShutdown.sh
vendored
Executable file
13
dist/bootstrapper/ReleaseLockAndAttemptShutdown.sh
vendored
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
kubectl delete ns ns-unity-builder-$NSID
|
||||||
|
|
||||||
|
# do any unity-builder namespaces remain?
|
||||||
|
namespaceCount=$(kubectl get ns --output json | jq ".items | .[] | select(.metadata.labels.app == \"unity-builder\") | select(.status.phase != \"TERMINATING\")" | jq -s "length")
|
||||||
|
echo $namespaceCount
|
||||||
|
if [ "$namespaceCount" != "0" ]
|
||||||
|
then
|
||||||
|
echo "let next cluster delete"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "delete cluster"
|
||||||
|
retry -s 15 -t 5 -v 'gcloud container clusters delete $GKE_CLUSTER --zone $GKE_ZONE --project $GKE_PROJECT --quiet'
|
||||||
|
fi
|
||||||
423
dist/cloud-formations/base-setup.yml
vendored
Normal file
423
dist/cloud-formations/base-setup.yml
vendored
Normal file
@@ -0,0 +1,423 @@
|
|||||||
|
AWSTemplateFormatVersion: '2010-09-09'
|
||||||
|
Description: AWS Fargate cluster that can span public and private subnets. Supports
|
||||||
|
public facing load balancers, private internal load balancers, and
|
||||||
|
both internal and external service discovery namespaces.
|
||||||
|
Parameters:
|
||||||
|
EnvironmentName:
|
||||||
|
Type: String
|
||||||
|
Default: development
|
||||||
|
Description: "Your deployment environment: DEV, QA , PROD"
|
||||||
|
|
||||||
|
# ContainerPort:
|
||||||
|
# Type: Number
|
||||||
|
# Default: 80
|
||||||
|
# Description: What port number the application inside the docker container is binding to
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mappings:
|
||||||
|
# Hard values for the subnet masks. These masks define
|
||||||
|
# the range of internal IP addresses that can be assigned.
|
||||||
|
# The VPC can have all IP's from 10.0.0.0 to 10.0.255.255
|
||||||
|
# There are four subnets which cover the ranges:
|
||||||
|
#
|
||||||
|
# 10.0.0.0 - 10.0.0.255
|
||||||
|
# 10.0.1.0 - 10.0.1.255
|
||||||
|
# 10.0.2.0 - 10.0.2.255
|
||||||
|
# 10.0.3.0 - 10.0.3.255
|
||||||
|
|
||||||
|
SubnetConfig:
|
||||||
|
VPC:
|
||||||
|
CIDR: '10.0.0.0/16'
|
||||||
|
PublicOne:
|
||||||
|
CIDR: '10.0.0.0/24'
|
||||||
|
PublicTwo:
|
||||||
|
CIDR: '10.0.1.0/24'
|
||||||
|
|
||||||
|
Resources:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# VPC in which containers will be networked.
|
||||||
|
# It has two public subnets, and two private subnets.
|
||||||
|
# We distribute the subnets across the first two available subnets
|
||||||
|
# for the region, for high availability.
|
||||||
|
VPC:
|
||||||
|
Type: AWS::EC2::VPC
|
||||||
|
Properties:
|
||||||
|
EnableDnsSupport: true
|
||||||
|
EnableDnsHostnames: true
|
||||||
|
CidrBlock: !FindInMap ['SubnetConfig', 'VPC', 'CIDR']
|
||||||
|
|
||||||
|
EFSServerSecurityGroup:
|
||||||
|
Type: AWS::EC2::SecurityGroup
|
||||||
|
Properties:
|
||||||
|
GroupName: "efs-server-endpoints"
|
||||||
|
GroupDescription: Which client ip addrs are allowed to access EFS server
|
||||||
|
VpcId: !Ref 'VPC'
|
||||||
|
SecurityGroupIngress:
|
||||||
|
- IpProtocol: tcp
|
||||||
|
FromPort: 2049
|
||||||
|
ToPort: 2049
|
||||||
|
SourceSecurityGroupId: !Ref ContainerSecurityGroup
|
||||||
|
#CidrIp: !FindInMap ['SubnetConfig', 'VPC', 'CIDR']
|
||||||
|
# A security group for the containers we will run in Fargate.
|
||||||
|
# Rules are added to this security group based on what ingress you
|
||||||
|
# add for the cluster.
|
||||||
|
ContainerSecurityGroup:
|
||||||
|
Type: AWS::EC2::SecurityGroup
|
||||||
|
Properties:
|
||||||
|
GroupName: "task security group"
|
||||||
|
GroupDescription: Access to the Fargate containers
|
||||||
|
VpcId: !Ref 'VPC'
|
||||||
|
# SecurityGroupIngress:
|
||||||
|
# - IpProtocol: tcp
|
||||||
|
# FromPort: !Ref ContainerPort
|
||||||
|
# ToPort: !Ref ContainerPort
|
||||||
|
# CidrIp: 0.0.0.0/0
|
||||||
|
SecurityGroupEgress:
|
||||||
|
- IpProtocol: -1
|
||||||
|
FromPort: 2049
|
||||||
|
ToPort: 2049
|
||||||
|
CidrIp: "0.0.0.0/0"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Two public subnets, where containers can have public IP addresses
|
||||||
|
PublicSubnetOne:
|
||||||
|
Type: AWS::EC2::Subnet
|
||||||
|
Properties:
|
||||||
|
AvailabilityZone: !Select
|
||||||
|
- 0
|
||||||
|
- Fn::GetAZs: !Ref 'AWS::Region'
|
||||||
|
VpcId: !Ref 'VPC'
|
||||||
|
CidrBlock: !FindInMap ['SubnetConfig', 'PublicOne', 'CIDR']
|
||||||
|
# MapPublicIpOnLaunch: true
|
||||||
|
|
||||||
|
PublicSubnetTwo:
|
||||||
|
Type: AWS::EC2::Subnet
|
||||||
|
Properties:
|
||||||
|
AvailabilityZone: !Select
|
||||||
|
- 1
|
||||||
|
- Fn::GetAZs: !Ref 'AWS::Region'
|
||||||
|
VpcId: !Ref 'VPC'
|
||||||
|
CidrBlock: !FindInMap ['SubnetConfig', 'PublicTwo', 'CIDR']
|
||||||
|
# MapPublicIpOnLaunch: true
|
||||||
|
|
||||||
|
|
||||||
|
# Setup networking resources for the public subnets. Containers
|
||||||
|
# in the public subnets have public IP addresses and the routing table
|
||||||
|
# sends network traffic via the internet gateway.
|
||||||
|
InternetGateway:
|
||||||
|
Type: AWS::EC2::InternetGateway
|
||||||
|
GatewayAttachement:
|
||||||
|
Type: AWS::EC2::VPCGatewayAttachment
|
||||||
|
Properties:
|
||||||
|
VpcId: !Ref 'VPC'
|
||||||
|
InternetGatewayId: !Ref 'InternetGateway'
|
||||||
|
|
||||||
|
# Attaching a Internet Gateway to route table makes it public.
|
||||||
|
PublicRouteTable:
|
||||||
|
Type: AWS::EC2::RouteTable
|
||||||
|
Properties:
|
||||||
|
VpcId: !Ref 'VPC'
|
||||||
|
PublicRoute:
|
||||||
|
Type: AWS::EC2::Route
|
||||||
|
DependsOn: GatewayAttachement
|
||||||
|
Properties:
|
||||||
|
RouteTableId: !Ref 'PublicRouteTable'
|
||||||
|
DestinationCidrBlock: '0.0.0.0/0'
|
||||||
|
GatewayId: !Ref 'InternetGateway'
|
||||||
|
|
||||||
|
# Attaching a public route table makes a subnet public.
|
||||||
|
PublicSubnetOneRouteTableAssociation:
|
||||||
|
Type: AWS::EC2::SubnetRouteTableAssociation
|
||||||
|
Properties:
|
||||||
|
SubnetId: !Ref PublicSubnetOne
|
||||||
|
RouteTableId: !Ref PublicRouteTable
|
||||||
|
PublicSubnetTwoRouteTableAssociation:
|
||||||
|
Type: AWS::EC2::SubnetRouteTableAssociation
|
||||||
|
Properties:
|
||||||
|
SubnetId: !Ref PublicSubnetTwo
|
||||||
|
RouteTableId: !Ref PublicRouteTable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ECS Resources
|
||||||
|
ECSCluster:
|
||||||
|
Type: AWS::ECS::Cluster
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# A role used to allow AWS Autoscaling to inspect stats and adjust scaleable targets
|
||||||
|
# on your AWS account
|
||||||
|
AutoscalingRole:
|
||||||
|
Type: AWS::IAM::Role
|
||||||
|
Properties:
|
||||||
|
AssumeRolePolicyDocument:
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Principal:
|
||||||
|
Service: [application-autoscaling.amazonaws.com]
|
||||||
|
Action: ['sts:AssumeRole']
|
||||||
|
Path: /
|
||||||
|
Policies:
|
||||||
|
- PolicyName: service-autoscaling
|
||||||
|
PolicyDocument:
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Action:
|
||||||
|
- 'application-autoscaling:*'
|
||||||
|
- 'cloudwatch:DescribeAlarms'
|
||||||
|
- 'cloudwatch:PutMetricAlarm'
|
||||||
|
- 'ecs:DescribeServices'
|
||||||
|
- 'ecs:UpdateService'
|
||||||
|
Resource: '*'
|
||||||
|
|
||||||
|
# This is an IAM role which authorizes ECS to manage resources on your
|
||||||
|
# account on your behalf, such as updating your load balancer with the
|
||||||
|
# details of where your containers are, so that traffic can reach your
|
||||||
|
# containers.
|
||||||
|
ECSRole:
|
||||||
|
Type: AWS::IAM::Role
|
||||||
|
Properties:
|
||||||
|
AssumeRolePolicyDocument:
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Principal:
|
||||||
|
Service: [ecs.amazonaws.com]
|
||||||
|
Action: ['sts:AssumeRole']
|
||||||
|
Path: /
|
||||||
|
Policies:
|
||||||
|
- PolicyName: ecs-service
|
||||||
|
PolicyDocument:
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Action:
|
||||||
|
# Rules which allow ECS to attach network interfaces to instances
|
||||||
|
# on your behalf in order for awsvpc networking mode to work right
|
||||||
|
- 'ec2:AttachNetworkInterface'
|
||||||
|
- 'ec2:CreateNetworkInterface'
|
||||||
|
- 'ec2:CreateNetworkInterfacePermission'
|
||||||
|
- 'ec2:DeleteNetworkInterface'
|
||||||
|
- 'ec2:DeleteNetworkInterfacePermission'
|
||||||
|
- 'ec2:Describe*'
|
||||||
|
- 'ec2:DetachNetworkInterface'
|
||||||
|
|
||||||
|
# Rules which allow ECS to update load balancers on your behalf
|
||||||
|
# with the information sabout how to send traffic to your containers
|
||||||
|
- 'elasticloadbalancing:DeregisterInstancesFromLoadBalancer'
|
||||||
|
- 'elasticloadbalancing:DeregisterTargets'
|
||||||
|
- 'elasticloadbalancing:Describe*'
|
||||||
|
- 'elasticloadbalancing:RegisterInstancesWithLoadBalancer'
|
||||||
|
- 'elasticloadbalancing:RegisterTargets'
|
||||||
|
Resource: '*'
|
||||||
|
|
||||||
|
# This is a role which is used by the ECS tasks themselves.
|
||||||
|
ECSTaskExecutionRole:
|
||||||
|
Type: AWS::IAM::Role
|
||||||
|
Properties:
|
||||||
|
AssumeRolePolicyDocument:
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Principal:
|
||||||
|
Service: [ecs-tasks.amazonaws.com]
|
||||||
|
Action: ['sts:AssumeRole']
|
||||||
|
Path: /
|
||||||
|
Policies:
|
||||||
|
- PolicyName: AmazonECSTaskExecutionRolePolicy
|
||||||
|
PolicyDocument:
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Action:
|
||||||
|
# Allow upload to S3
|
||||||
|
- 's3:GetObject'
|
||||||
|
- 's3:GetObjectVersion'
|
||||||
|
- 's3:PutObject'
|
||||||
|
|
||||||
|
# Allow the use of secret manager
|
||||||
|
- 'secretsmanager:GetSecretValue'
|
||||||
|
- 'kms:Decrypt'
|
||||||
|
|
||||||
|
# Allow the ECS Tasks to download images from ECR
|
||||||
|
- 'ecr:GetAuthorizationToken'
|
||||||
|
- 'ecr:BatchCheckLayerAvailability'
|
||||||
|
- 'ecr:GetDownloadUrlForLayer'
|
||||||
|
- 'ecr:BatchGetImage'
|
||||||
|
|
||||||
|
# Allow the ECS tasks to upload logs to CloudWatch
|
||||||
|
- 'logs:CreateLogStream'
|
||||||
|
- 'logs:PutLogEvents'
|
||||||
|
Resource: '*'
|
||||||
|
|
||||||
|
DeleteCFNLambdaExecutionRole:
|
||||||
|
Type: "AWS::IAM::Role"
|
||||||
|
Properties:
|
||||||
|
AssumeRolePolicyDocument:
|
||||||
|
Version: "2012-10-17"
|
||||||
|
Statement:
|
||||||
|
- Effect: "Allow"
|
||||||
|
Principal:
|
||||||
|
Service: ["lambda.amazonaws.com"]
|
||||||
|
Action: "sts:AssumeRole"
|
||||||
|
Path: "/"
|
||||||
|
Policies:
|
||||||
|
- PolicyName: DeleteCFNLambdaExecutionRole
|
||||||
|
PolicyDocument:
|
||||||
|
Version: "2012-10-17"
|
||||||
|
Statement:
|
||||||
|
- Effect: "Allow"
|
||||||
|
Action:
|
||||||
|
- "logs:CreateLogGroup"
|
||||||
|
- "logs:CreateLogStream"
|
||||||
|
- "logs:PutLogEvents"
|
||||||
|
Resource: "arn:aws:logs:*:*:*"
|
||||||
|
- Effect: "Allow"
|
||||||
|
Action:
|
||||||
|
- "cloudformation:DeleteStack"
|
||||||
|
- "kinesis:DeleteStream"
|
||||||
|
- "secretsmanager:DeleteSecret"
|
||||||
|
- "kinesis:DescribeStreamSummary"
|
||||||
|
- "logs:DeleteLogGroup"
|
||||||
|
- "logs:DeleteSubscriptionFilter"
|
||||||
|
- "ecs:DeregisterTaskDefinition"
|
||||||
|
- "lambda:DeleteFunction"
|
||||||
|
- "lambda:InvokeFunction"
|
||||||
|
- "events:RemoveTargets"
|
||||||
|
- "events:DeleteRule"
|
||||||
|
- "lambda:RemovePermission"
|
||||||
|
Resource: "*"
|
||||||
|
|
||||||
|
### cloud watch to kinesis role
|
||||||
|
|
||||||
|
CloudWatchIAMRole:
|
||||||
|
Type: AWS::IAM::Role
|
||||||
|
Properties:
|
||||||
|
AssumeRolePolicyDocument:
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Principal:
|
||||||
|
Service: [logs.amazonaws.com]
|
||||||
|
Action: ['sts:AssumeRole']
|
||||||
|
Path: /
|
||||||
|
Policies:
|
||||||
|
- PolicyName: service-autoscaling
|
||||||
|
PolicyDocument:
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Action:
|
||||||
|
- 'kinesis:PutRecord'
|
||||||
|
Resource: '*'
|
||||||
|
#####################EFS#####################
|
||||||
|
|
||||||
|
EfsFileStorage:
|
||||||
|
Type: 'AWS::EFS::FileSystem'
|
||||||
|
Properties:
|
||||||
|
BackupPolicy:
|
||||||
|
Status: ENABLED
|
||||||
|
PerformanceMode: maxIO
|
||||||
|
Encrypted: false
|
||||||
|
|
||||||
|
|
||||||
|
FileSystemPolicy:
|
||||||
|
Version: "2012-10-17"
|
||||||
|
Statement:
|
||||||
|
- Effect: "Allow"
|
||||||
|
Action:
|
||||||
|
- "elasticfilesystem:ClientMount"
|
||||||
|
- "elasticfilesystem:ClientWrite"
|
||||||
|
- "elasticfilesystem:ClientRootAccess"
|
||||||
|
Principal:
|
||||||
|
AWS: "*"
|
||||||
|
|
||||||
|
|
||||||
|
MountTargetResource1:
|
||||||
|
Type: AWS::EFS::MountTarget
|
||||||
|
Properties:
|
||||||
|
FileSystemId: !Ref EfsFileStorage
|
||||||
|
SubnetId: !Ref PublicSubnetOne
|
||||||
|
SecurityGroups:
|
||||||
|
- !Ref EFSServerSecurityGroup
|
||||||
|
|
||||||
|
MountTargetResource2:
|
||||||
|
Type: AWS::EFS::MountTarget
|
||||||
|
Properties:
|
||||||
|
FileSystemId: !Ref EfsFileStorage
|
||||||
|
SubnetId: !Ref PublicSubnetTwo
|
||||||
|
SecurityGroups:
|
||||||
|
- !Ref EFSServerSecurityGroup
|
||||||
|
|
||||||
|
S3Bucket:
|
||||||
|
Type: 'AWS::S3::Bucket'
|
||||||
|
DeletionPolicy: Retain
|
||||||
|
Properties:
|
||||||
|
BucketName: game-ci-storage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Outputs:
|
||||||
|
|
||||||
|
EfsFileStorageId:
|
||||||
|
Description: 'The connection endpoint for the database.'
|
||||||
|
Value: !Ref EfsFileStorage
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:EfsFileStorageId
|
||||||
|
ClusterName:
|
||||||
|
Description: The name of the ECS cluster
|
||||||
|
Value: !Ref 'ECSCluster'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:ClusterName
|
||||||
|
AutoscalingRole:
|
||||||
|
Description: The ARN of the role used for autoscaling
|
||||||
|
Value: !GetAtt 'AutoscalingRole.Arn'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:AutoscalingRole
|
||||||
|
ECSRole:
|
||||||
|
Description: The ARN of the ECS role
|
||||||
|
Value: !GetAtt 'ECSRole.Arn'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:ECSRole
|
||||||
|
ECSTaskExecutionRole:
|
||||||
|
Description: The ARN of the ECS role tsk execution role
|
||||||
|
Value: !GetAtt 'ECSTaskExecutionRole.Arn'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:ECSTaskExecutionRole
|
||||||
|
|
||||||
|
DeleteCFNLambdaExecutionRole:
|
||||||
|
Description: Lambda execution role for cleaning up cloud formations
|
||||||
|
Value: !GetAtt 'DeleteCFNLambdaExecutionRole.Arn'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:DeleteCFNLambdaExecutionRole
|
||||||
|
|
||||||
|
CloudWatchIAMRole:
|
||||||
|
Description: The ARN of the CloudWatch role for subscription filter
|
||||||
|
Value: !GetAtt 'CloudWatchIAMRole.Arn'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:CloudWatchIAMRole
|
||||||
|
VpcId:
|
||||||
|
Description: The ID of the VPC that this stack is deployed in
|
||||||
|
Value: !Ref 'VPC'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:VpcId
|
||||||
|
PublicSubnetOne:
|
||||||
|
Description: Public subnet one
|
||||||
|
Value: !Ref 'PublicSubnetOne'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:PublicSubnetOne
|
||||||
|
PublicSubnetTwo:
|
||||||
|
Description: Public subnet two
|
||||||
|
Value: !Ref 'PublicSubnetTwo'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:PublicSubnetTwo
|
||||||
|
|
||||||
|
ContainerSecurityGroup:
|
||||||
|
Description: A security group used to allow Fargate containers to receive traffic
|
||||||
|
Value: !Ref 'ContainerSecurityGroup'
|
||||||
|
Export:
|
||||||
|
Name: !Sub ${EnvironmentName}:ContainerSecurityGroup
|
||||||
143
dist/cloud-formations/cloudformation-stack-ttl.yml
vendored
Normal file
143
dist/cloud-formations/cloudformation-stack-ttl.yml
vendored
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
AWSTemplateFormatVersion: '2010-09-09'
|
||||||
|
Description: Schedule automatic deletion of CloudFormation stacks
|
||||||
|
Metadata:
|
||||||
|
AWS::CloudFormation::Interface:
|
||||||
|
ParameterGroups:
|
||||||
|
- Label:
|
||||||
|
default: Input configuration
|
||||||
|
Parameters:
|
||||||
|
- StackName
|
||||||
|
- TTL
|
||||||
|
ParameterLabels:
|
||||||
|
StackName:
|
||||||
|
default: Stack name
|
||||||
|
TTL:
|
||||||
|
default: Time-to-live
|
||||||
|
Parameters:
|
||||||
|
EnvironmentName:
|
||||||
|
Type: String
|
||||||
|
Default: development
|
||||||
|
Description: 'Your deployment environment: DEV, QA , PROD'
|
||||||
|
BUILDID:
|
||||||
|
Type: String
|
||||||
|
Default: ''
|
||||||
|
StackName:
|
||||||
|
Type: String
|
||||||
|
Description: Stack name that will be deleted.
|
||||||
|
DeleteStackName:
|
||||||
|
Type: String
|
||||||
|
Description: Stack name that will be deleted.
|
||||||
|
TTL:
|
||||||
|
Type: Number
|
||||||
|
Description: Time-to-live in minutes for the stack.
|
||||||
|
Resources:
|
||||||
|
DeleteCFNLambda:
|
||||||
|
Type: "AWS::Lambda::Function"
|
||||||
|
Properties:
|
||||||
|
FunctionName: !Join [ "", [ 'DeleteCFNLambda', !Ref BUILDID ] ]
|
||||||
|
Code:
|
||||||
|
ZipFile: |
|
||||||
|
import boto3
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
stack_name = os.environ['stackName']
|
||||||
|
delete_stack_name = os.environ['deleteStackName']
|
||||||
|
|
||||||
|
def delete_cfn(stack_name):
|
||||||
|
try:
|
||||||
|
cfn = boto3.resource('cloudformation')
|
||||||
|
stack = cfn.Stack(stack_name)
|
||||||
|
stack.delete()
|
||||||
|
return "SUCCESS"
|
||||||
|
except:
|
||||||
|
return "ERROR"
|
||||||
|
|
||||||
|
def handler(event, context):
|
||||||
|
print("Received event:")
|
||||||
|
print(json.dumps(event))
|
||||||
|
result = delete_cfn(stack_name)
|
||||||
|
delete_cfn(delete_stack_name)
|
||||||
|
return result
|
||||||
|
Environment:
|
||||||
|
Variables:
|
||||||
|
stackName: !Ref 'StackName'
|
||||||
|
deleteStackName: !Ref 'DeleteStackName'
|
||||||
|
Handler: "index.handler"
|
||||||
|
Runtime: "python3.6"
|
||||||
|
Timeout: "5"
|
||||||
|
Role:
|
||||||
|
'Fn::ImportValue': !Sub '${EnvironmentName}:DeleteCFNLambdaExecutionRole'
|
||||||
|
DeleteStackEventRule:
|
||||||
|
DependsOn:
|
||||||
|
- DeleteCFNLambda
|
||||||
|
- GenerateCronExpression
|
||||||
|
Type: "AWS::Events::Rule"
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'DeleteStackEventRule', !Ref BUILDID ] ]
|
||||||
|
Description: Delete stack event
|
||||||
|
ScheduleExpression: !GetAtt GenerateCronExpression.cron_exp
|
||||||
|
State: "ENABLED"
|
||||||
|
Targets:
|
||||||
|
-
|
||||||
|
Arn: !GetAtt DeleteCFNLambda.Arn
|
||||||
|
Id: 'DeleteCFNLambda'
|
||||||
|
PermissionForDeleteCFNLambda:
|
||||||
|
Type: "AWS::Lambda::Permission"
|
||||||
|
DependsOn:
|
||||||
|
- DeleteStackEventRule
|
||||||
|
Properties:
|
||||||
|
FunctionName: !Join [ "", [ 'DeleteCFNLambda', !Ref BUILDID ] ]
|
||||||
|
Action: "lambda:InvokeFunction"
|
||||||
|
Principal: "events.amazonaws.com"
|
||||||
|
SourceArn: !GetAtt DeleteStackEventRule.Arn
|
||||||
|
GenerateCronExpLambda:
|
||||||
|
Type: "AWS::Lambda::Function"
|
||||||
|
Properties:
|
||||||
|
FunctionName: !Join [ "", [ 'GenerateCronExpressionLambda', !Ref BUILDID ] ]
|
||||||
|
Code:
|
||||||
|
ZipFile: |
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
import os
|
||||||
|
import logging
|
||||||
|
import json
|
||||||
|
import cfnresponse
|
||||||
|
|
||||||
|
def deletion_time(ttl):
|
||||||
|
delete_at_time = datetime.now() + timedelta(minutes=int(ttl))
|
||||||
|
hh = delete_at_time.hour
|
||||||
|
mm = delete_at_time.minute
|
||||||
|
yyyy = delete_at_time.year
|
||||||
|
month = delete_at_time.month
|
||||||
|
dd = delete_at_time.day
|
||||||
|
# minutes hours day month day-of-week year
|
||||||
|
cron_exp = "cron({} {} {} {} ? {})".format(mm, hh, dd, month, yyyy)
|
||||||
|
return cron_exp
|
||||||
|
|
||||||
|
def handler(event, context):
|
||||||
|
print('Received event: %s' % json.dumps(event))
|
||||||
|
status = cfnresponse.SUCCESS
|
||||||
|
try:
|
||||||
|
if event['RequestType'] == 'Delete':
|
||||||
|
cfnresponse.send(event, context, status, {})
|
||||||
|
else:
|
||||||
|
ttl = event['ResourceProperties']['ttl']
|
||||||
|
responseData = {}
|
||||||
|
responseData['cron_exp'] = deletion_time(ttl)
|
||||||
|
cfnresponse.send(event, context, cfnresponse.SUCCESS, responseData)
|
||||||
|
except Exception as e:
|
||||||
|
logging.error('Exception: %s' % e, exc_info=True)
|
||||||
|
status = cfnresponse.FAILED
|
||||||
|
cfnresponse.send(event, context, status, {}, None)
|
||||||
|
Handler: "index.handler"
|
||||||
|
Runtime: "python3.6"
|
||||||
|
Timeout: "5"
|
||||||
|
Role:
|
||||||
|
'Fn::ImportValue': !Sub '${EnvironmentName}:DeleteCFNLambdaExecutionRole'
|
||||||
|
GenerateCronExpression:
|
||||||
|
Type: "Custom::GenerateCronExpression"
|
||||||
|
Version: "1.0"
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'GenerateCronExpression', !Ref BUILDID ] ]
|
||||||
|
ServiceToken: !GetAtt GenerateCronExpLambda.Arn
|
||||||
|
ttl: !Ref 'TTL'
|
||||||
322
dist/cloud-formations/task-def-formation.yml
vendored
Normal file
322
dist/cloud-formations/task-def-formation.yml
vendored
Normal file
@@ -0,0 +1,322 @@
|
|||||||
|
AWSTemplateFormatVersion: 2010-09-09
|
||||||
|
Description: >-
|
||||||
|
AWS Fargate cluster that can span public and private subnets. Supports public
|
||||||
|
facing load balancers, private internal load balancers, and both internal and
|
||||||
|
external service discovery namespaces.
|
||||||
|
Parameters:
|
||||||
|
EnvironmentName:
|
||||||
|
Type: String
|
||||||
|
Default: development
|
||||||
|
Description: 'Your deployment environment: DEV, QA , PROD'
|
||||||
|
ServiceName:
|
||||||
|
Type: String
|
||||||
|
Default: example
|
||||||
|
Description: A name for the service
|
||||||
|
ImageUrl:
|
||||||
|
Type: String
|
||||||
|
Default: nginx
|
||||||
|
Description: >-
|
||||||
|
The url of a docker image that contains the application process that will
|
||||||
|
handle the traffic for this service
|
||||||
|
ContainerPort:
|
||||||
|
Type: Number
|
||||||
|
Default: 80
|
||||||
|
Description: What port number the application inside the docker container is binding to
|
||||||
|
ContainerCpu:
|
||||||
|
Type: Number
|
||||||
|
Default: 1024
|
||||||
|
Description: How much CPU to give the container. 1024 is 1 CPU
|
||||||
|
ContainerMemory:
|
||||||
|
Type: Number
|
||||||
|
Default: 2048
|
||||||
|
Description: How much memory in megabytes to give the container
|
||||||
|
BUILDID:
|
||||||
|
Type: String
|
||||||
|
Default: ''
|
||||||
|
Command:
|
||||||
|
Type: String
|
||||||
|
Default: 'ls'
|
||||||
|
EntryPoint:
|
||||||
|
Type: String
|
||||||
|
Default: '/bin/sh'
|
||||||
|
WorkingDirectory:
|
||||||
|
Type: String
|
||||||
|
Default: '/efsdata/'
|
||||||
|
Role:
|
||||||
|
Type: String
|
||||||
|
Default: ''
|
||||||
|
Description: >-
|
||||||
|
(Optional) An IAM role to give the service's containers if the code within
|
||||||
|
needs to access other AWS resources like S3 buckets, DynamoDB tables, etc
|
||||||
|
EFSMountDirectory:
|
||||||
|
Type: String
|
||||||
|
Default: '/efsdata'
|
||||||
|
GithubToken:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
UnityLicense:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
UnityEmail:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
UnityPassword:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
UnitySerial:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
AndroidKeystoreBase64:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
AndroidKeystorePass:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
AndroidKeyAliasPass:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
AWSAccessKeyID:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
AWSSecretAccessKey:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
Mappings:
|
||||||
|
SubnetConfig:
|
||||||
|
VPC:
|
||||||
|
CIDR: 10.0.0.0/16
|
||||||
|
PublicOne:
|
||||||
|
CIDR: 10.0.0.0/24
|
||||||
|
PublicTwo:
|
||||||
|
CIDR: 10.0.1.0/24
|
||||||
|
Conditions:
|
||||||
|
HasCustomRole: !Not
|
||||||
|
- !Equals
|
||||||
|
- Ref: Role
|
||||||
|
- ''
|
||||||
|
Resources:
|
||||||
|
LogGroup:
|
||||||
|
Type: 'AWS::Logs::LogGroup'
|
||||||
|
Properties:
|
||||||
|
LogGroupName: !Ref ServiceName
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
id: aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
SubscriptionFilter:
|
||||||
|
Type: 'AWS::Logs::SubscriptionFilter'
|
||||||
|
Properties:
|
||||||
|
FilterPattern: ''
|
||||||
|
RoleArn:
|
||||||
|
'Fn::ImportValue': !Sub '${EnvironmentName}:CloudWatchIAMRole'
|
||||||
|
LogGroupName: !Ref ServiceName
|
||||||
|
DestinationArn:
|
||||||
|
'Fn::GetAtt':
|
||||||
|
- KinesisStream
|
||||||
|
- Arn
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
id: 7f809e91-9e5d-4678-98c1-c5085956c480
|
||||||
|
DependsOn:
|
||||||
|
- LogGroup
|
||||||
|
- KinesisStream
|
||||||
|
KinesisStream:
|
||||||
|
Type: 'AWS::Kinesis::Stream'
|
||||||
|
Properties:
|
||||||
|
Name: !Ref ServiceName
|
||||||
|
ShardCount: 1
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
id: c6f18447-b879-4696-8873-f981b2cedd2b
|
||||||
|
|
||||||
|
GithubTokenSecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'GithubToken', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref GithubToken
|
||||||
|
|
||||||
|
UnityLicenseSecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'UnityLicense', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref UnityLicense
|
||||||
|
|
||||||
|
UnityEmailSecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'UnityEmail', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref UnityEmail
|
||||||
|
|
||||||
|
UnityPasswordSecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'UnityPassword', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref UnityPassword
|
||||||
|
|
||||||
|
UnitySerialSecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'UnitySerial', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref UnitySerial
|
||||||
|
|
||||||
|
AndroidKeystoreBase64Secret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'AndroidKeystoreBase64', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref AndroidKeystoreBase64
|
||||||
|
|
||||||
|
AndroidKeystorePassSecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'AndroidKeystorePass', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref AndroidKeystorePass
|
||||||
|
|
||||||
|
AndroidKeyAliasPassSecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'AndroidKeyAliasPass', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref AndroidKeyAliasPass
|
||||||
|
AWSAccessKeyIDSecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'AWSAccessKeyID', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref AWSAccessKeyID
|
||||||
|
AWSSecretAccessKeySecret:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'AWSSecretAccessKey', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref AWSSecretAccessKey
|
||||||
|
|
||||||
|
TaskDefinition:
|
||||||
|
Type: 'AWS::ECS::TaskDefinition'
|
||||||
|
Properties:
|
||||||
|
Family: !Ref ServiceName
|
||||||
|
Cpu: !Ref ContainerCpu
|
||||||
|
Memory: !Ref ContainerMemory
|
||||||
|
NetworkMode: awsvpc
|
||||||
|
Volumes:
|
||||||
|
- Name: efs-data
|
||||||
|
EFSVolumeConfiguration:
|
||||||
|
FilesystemId:
|
||||||
|
'Fn::ImportValue': !Sub '${EnvironmentName}:EfsFileStorageId'
|
||||||
|
TransitEncryption: ENABLED
|
||||||
|
RequiresCompatibilities:
|
||||||
|
- FARGATE
|
||||||
|
ExecutionRoleArn:
|
||||||
|
'Fn::ImportValue': !Sub '${EnvironmentName}:ECSTaskExecutionRole'
|
||||||
|
TaskRoleArn:
|
||||||
|
'Fn::If':
|
||||||
|
- HasCustomRole
|
||||||
|
- !Ref Role
|
||||||
|
- !Ref 'AWS::NoValue'
|
||||||
|
ContainerDefinitions:
|
||||||
|
- Name: !Ref ServiceName
|
||||||
|
Cpu: !Ref ContainerCpu
|
||||||
|
Memory: !Ref ContainerMemory
|
||||||
|
Image: !Ref ImageUrl
|
||||||
|
EntryPoint:
|
||||||
|
Fn::Split:
|
||||||
|
- ","
|
||||||
|
- !Ref EntryPoint
|
||||||
|
Command:
|
||||||
|
Fn::Split:
|
||||||
|
- ","
|
||||||
|
- !Ref Command
|
||||||
|
WorkingDirectory: !Ref WorkingDirectory
|
||||||
|
Environment:
|
||||||
|
- Name: ALLOW_EMPTY_PASSWORD
|
||||||
|
Value: 'yes'
|
||||||
|
MountPoints:
|
||||||
|
- SourceVolume: efs-data
|
||||||
|
ContainerPath: !Ref EFSMountDirectory
|
||||||
|
ReadOnly: false
|
||||||
|
Secrets:
|
||||||
|
- Name: 'GITHUB_TOKEN'
|
||||||
|
ValueFrom: !Ref GithubTokenSecret
|
||||||
|
- Name: 'UNITY_LICENSE'
|
||||||
|
ValueFrom: !Ref UnityLicenseSecret
|
||||||
|
- Name: 'UNITY_EMAIL'
|
||||||
|
ValueFrom: !Ref UnityEmailSecret
|
||||||
|
- Name: 'UNITY_PASSWORD'
|
||||||
|
ValueFrom: !Ref UnityPasswordSecret
|
||||||
|
- Name: 'UNITY_SERIAL'
|
||||||
|
ValueFrom: !Ref UnitySerialSecret
|
||||||
|
- Name: 'ANDROID_KEYSTORE_BASE64'
|
||||||
|
ValueFrom: !Ref AndroidKeystoreBase64Secret
|
||||||
|
- Name: 'ANDROID_KEYSTORE_PASS'
|
||||||
|
ValueFrom: !Ref AndroidKeystorePassSecret
|
||||||
|
- Name: 'AWS_ACCESS_KEY_ID'
|
||||||
|
ValueFrom: !Ref AWSAccessKeyIDSecret
|
||||||
|
- Name: 'AWS_SECRET_ACCESS_KEY'
|
||||||
|
ValueFrom: !Ref AWSSecretAccessKeySecret
|
||||||
|
LogConfiguration:
|
||||||
|
LogDriver: awslogs
|
||||||
|
Options:
|
||||||
|
awslogs-group: !Ref ServiceName
|
||||||
|
awslogs-region: !Ref 'AWS::Region'
|
||||||
|
awslogs-stream-prefix: !Ref ServiceName
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
id: dabb0116-abe0-48a6-a8af-cf9111c879a5
|
||||||
|
DependsOn:
|
||||||
|
- LogGroup
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
dabb0116-abe0-48a6-a8af-cf9111c879a5:
|
||||||
|
size:
|
||||||
|
width: 60
|
||||||
|
height: 60
|
||||||
|
position:
|
||||||
|
x: 270
|
||||||
|
'y': 90
|
||||||
|
z: 1
|
||||||
|
embeds: []
|
||||||
|
dependson:
|
||||||
|
- aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
c6f18447-b879-4696-8873-f981b2cedd2b:
|
||||||
|
size:
|
||||||
|
width: 60
|
||||||
|
height: 60
|
||||||
|
position:
|
||||||
|
x: 270
|
||||||
|
'y': 210
|
||||||
|
z: 1
|
||||||
|
embeds: []
|
||||||
|
7f809e91-9e5d-4678-98c1-c5085956c480:
|
||||||
|
size:
|
||||||
|
width: 60
|
||||||
|
height: 60
|
||||||
|
position:
|
||||||
|
x: 60
|
||||||
|
'y': 300
|
||||||
|
z: 1
|
||||||
|
embeds: []
|
||||||
|
dependson:
|
||||||
|
- aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
- c6f18447-b879-4696-8873-f981b2cedd2b
|
||||||
|
aece53ae-b82d-4267-bc16-ed964b05db27:
|
||||||
|
size:
|
||||||
|
width: 150
|
||||||
|
height: 150
|
||||||
|
position:
|
||||||
|
x: 60
|
||||||
|
'y': 90
|
||||||
|
z: 1
|
||||||
|
embeds: []
|
||||||
|
4d2da56c-3643-46b8-aaee-e46e19f95fcc:
|
||||||
|
source:
|
||||||
|
id: 7f809e91-9e5d-4678-98c1-c5085956c480
|
||||||
|
target:
|
||||||
|
id: aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
z: 11
|
||||||
|
14eb957b-f094-4653-93c4-77b2f851953c:
|
||||||
|
source:
|
||||||
|
id: 7f809e91-9e5d-4678-98c1-c5085956c480
|
||||||
|
target:
|
||||||
|
id: c6f18447-b879-4696-8873-f981b2cedd2b
|
||||||
|
z: 12
|
||||||
|
85c57444-e5bb-4230-bc85-e545cd4558f6:
|
||||||
|
source:
|
||||||
|
id: dabb0116-abe0-48a6-a8af-cf9111c879a5
|
||||||
|
target:
|
||||||
|
id: aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
z: 13
|
||||||
8
dist/default-build-script/Assets/Editor/UnityBuilderAction.meta
vendored
Normal file
8
dist/default-build-script/Assets/Editor/UnityBuilderAction.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e9babefb99ee74048a824da81c20cbcd
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
83
dist/default-build-script/Assets/Editor/UnityBuilderAction/Builder.cs
vendored
Normal file
83
dist/default-build-script/Assets/Editor/UnityBuilderAction/Builder.cs
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityBuilderAction.Input;
|
||||||
|
using UnityBuilderAction.Reporting;
|
||||||
|
using UnityBuilderAction.Versioning;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Build.Reporting;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityBuilderAction
|
||||||
|
{
|
||||||
|
static class Builder
|
||||||
|
{
|
||||||
|
public static void BuildProject()
|
||||||
|
{
|
||||||
|
// Gather values from args
|
||||||
|
var options = ArgumentsParser.GetValidatedOptions();
|
||||||
|
|
||||||
|
// Gather values from project
|
||||||
|
var scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(s => s.path).ToArray();
|
||||||
|
|
||||||
|
// Get all buildOptions from options
|
||||||
|
BuildOptions buildOptions = BuildOptions.None;
|
||||||
|
foreach (string buildOptionString in Enum.GetNames(typeof(BuildOptions))) {
|
||||||
|
if (options.ContainsKey(buildOptionString)) {
|
||||||
|
BuildOptions buildOptionEnum = (BuildOptions) Enum.Parse(typeof(BuildOptions), buildOptionString);
|
||||||
|
buildOptions |= buildOptionEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define BuildPlayer Options
|
||||||
|
var buildPlayerOptions = new BuildPlayerOptions {
|
||||||
|
scenes = scenes,
|
||||||
|
locationPathName = options["customBuildPath"],
|
||||||
|
target = (BuildTarget) Enum.Parse(typeof(BuildTarget), options["buildTarget"]),
|
||||||
|
options = buildOptions
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set version for this build
|
||||||
|
VersionApplicator.SetVersion(options["buildVersion"]);
|
||||||
|
VersionApplicator.SetAndroidVersionCode(options["androidVersionCode"]);
|
||||||
|
|
||||||
|
// Apply Android settings
|
||||||
|
if (buildPlayerOptions.target == BuildTarget.Android)
|
||||||
|
AndroidSettings.Apply(options);
|
||||||
|
|
||||||
|
// Execute default AddressableAsset content build, if the package is installed.
|
||||||
|
// Version defines would be the best solution here, but Unity 2018 doesn't support that,
|
||||||
|
// so we fall back to using reflection instead.
|
||||||
|
var addressableAssetSettingsType = Type.GetType(
|
||||||
|
"UnityEditor.AddressableAssets.Settings.AddressableAssetSettings,Unity.Addressables.Editor");
|
||||||
|
if (addressableAssetSettingsType != null)
|
||||||
|
{
|
||||||
|
// ReSharper disable once PossibleNullReferenceException, used from try-catch
|
||||||
|
void CallAddressablesMethod(string methodName, object[] args) => addressableAssetSettingsType
|
||||||
|
.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public)
|
||||||
|
.Invoke(null, args);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CallAddressablesMethod("CleanPlayerContent", new object[] { null });
|
||||||
|
CallAddressablesMethod("BuildPlayerContent", Array.Empty<object>());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Failed to run default addressables build:\n{e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform build
|
||||||
|
BuildReport buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||||
|
|
||||||
|
// Summary
|
||||||
|
BuildSummary summary = buildReport.summary;
|
||||||
|
StdOutReporter.ReportSummary(summary);
|
||||||
|
|
||||||
|
// Result
|
||||||
|
BuildResult result = summary.result;
|
||||||
|
StdOutReporter.ExitWithResult(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs
vendored
Normal file
21
dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace UnityBuilderAction.Input
|
||||||
|
{
|
||||||
|
public class AndroidSettings
|
||||||
|
{
|
||||||
|
public static void Apply(Dictionary<string, string> options)
|
||||||
|
{
|
||||||
|
EditorUserBuildSettings.buildAppBundle = options["customBuildPath"].EndsWith(".aab");
|
||||||
|
if (options.TryGetValue("androidKeystoreName", out string keystoreName) && !string.IsNullOrEmpty(keystoreName))
|
||||||
|
PlayerSettings.Android.keystoreName = keystoreName;
|
||||||
|
if (options.TryGetValue("androidKeystorePass", out string keystorePass) && !string.IsNullOrEmpty(keystorePass))
|
||||||
|
PlayerSettings.Android.keystorePass = keystorePass;
|
||||||
|
if (options.TryGetValue("androidKeyaliasName", out string keyaliasName) && !string.IsNullOrEmpty(keyaliasName))
|
||||||
|
PlayerSettings.Android.keyaliasName = keyaliasName;
|
||||||
|
if (options.TryGetValue("androidKeyaliasPass", out string keyaliasPass) && !string.IsNullOrEmpty(keyaliasPass))
|
||||||
|
PlayerSettings.Android.keyaliasPass = keyaliasPass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs.meta
vendored
Normal file
11
dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0d51cf8acfff8c941bb753e82750b60a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|
||||||
namespace UnityBuilderAction.Input
|
namespace UnityBuilderAction.Input
|
||||||
@@ -7,6 +8,7 @@ namespace UnityBuilderAction.Input
|
|||||||
public class ArgumentsParser
|
public class ArgumentsParser
|
||||||
{
|
{
|
||||||
static string EOL = Environment.NewLine;
|
static string EOL = Environment.NewLine;
|
||||||
|
static readonly string[] Secrets = { "androidKeystorePass", "androidKeyaliasName", "androidKeyaliasPass" };
|
||||||
|
|
||||||
public static Dictionary<string, string> GetValidatedOptions()
|
public static Dictionary<string, string> GetValidatedOptions()
|
||||||
{
|
{
|
||||||
@@ -66,9 +68,11 @@ namespace UnityBuilderAction.Input
|
|||||||
// Parse optional value
|
// Parse optional value
|
||||||
bool flagHasValue = next < args.Length && !args[next].StartsWith("-");
|
bool flagHasValue = next < args.Length && !args[next].StartsWith("-");
|
||||||
string value = flagHasValue ? args[next].TrimStart('-') : "";
|
string value = flagHasValue ? args[next].TrimStart('-') : "";
|
||||||
|
bool secret = Secrets.Contains(flag);
|
||||||
|
string displayValue = secret ? "*HIDDEN*" : "\"" + value + "\"";
|
||||||
|
|
||||||
// Assign
|
// Assign
|
||||||
Console.WriteLine($"Found flag \"{flag}\" with value \"{value}\".");
|
Console.WriteLine($"Found flag \"{flag}\" with value {displayValue}.");
|
||||||
providedArguments.Add(flag, value);
|
providedArguments.Add(flag, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
15
dist/default-build-script/Assets/Editor/UnityBuilderAction/UnityBuilderAction.asmdef
vendored
Normal file
15
dist/default-build-script/Assets/Editor/UnityBuilderAction/UnityBuilderAction.asmdef
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "UnityBuilderAction",
|
||||||
|
"references": [],
|
||||||
|
"includePlatforms": [
|
||||||
|
"Editor"
|
||||||
|
],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": false,
|
||||||
|
"precompiledReferences": [],
|
||||||
|
"autoReferenced": true,
|
||||||
|
"defineConstraints": [],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
||||||
7
dist/default-build-script/Assets/Editor/UnityBuilderAction/UnityBuilderAction.asmdef.meta
vendored
Normal file
7
dist/default-build-script/Assets/Editor/UnityBuilderAction/UnityBuilderAction.asmdef.meta
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a1ab437d31f4f4c9084097e2b4b5fcae
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -104,7 +104,7 @@ namespace UnityBuilderAction.Versioning
|
|||||||
static string Run(string arguments)
|
static string Run(string arguments)
|
||||||
{
|
{
|
||||||
using (var process = new System.Diagnostics.Process()) {
|
using (var process = new System.Diagnostics.Process()) {
|
||||||
string workingDirectory = Application.dataPath;
|
string workingDirectory = UnityEngine.Application.dataPath;
|
||||||
|
|
||||||
int exitCode = process.Run(application, arguments, workingDirectory, out string output, out string errors);
|
int exitCode = process.Run(application, arguments, workingDirectory, out string output, out string errors);
|
||||||
if (exitCode != 0) { throw new GitException(exitCode, errors); }
|
if (exitCode != 0) { throw new GitException(exitCode, errors); }
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|
||||||
namespace UnityBuilderAction.Versioning
|
namespace UnityBuilderAction.Versioning
|
||||||
@@ -11,13 +10,18 @@ namespace UnityBuilderAction.Versioning
|
|||||||
if (version == "none") {
|
if (version == "none") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Apply(version);
|
Apply(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetAndroidVersionCode(string androidVersionCode) {
|
||||||
|
PlayerSettings.Android.bundleVersionCode = Int32.Parse(androidVersionCode);
|
||||||
|
}
|
||||||
|
|
||||||
static void Apply(string version)
|
static void Apply(string version)
|
||||||
{
|
{
|
||||||
PlayerSettings.bundleVersion = version;
|
PlayerSettings.bundleVersion = version;
|
||||||
|
PlayerSettings.macOS.buildNumber = version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
32
dist/entrypoint.sh
vendored
Executable file
32
dist/entrypoint.sh
vendored
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run steps
|
||||||
|
#
|
||||||
|
|
||||||
|
source /steps/activate.sh
|
||||||
|
source /steps/build.sh
|
||||||
|
source /steps/return_license.sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Instructions for debugging
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ $BUILD_EXIT_CODE -gt 0 ]]; then
|
||||||
|
echo ""
|
||||||
|
echo "###########################"
|
||||||
|
echo "# Failure #"
|
||||||
|
echo "###########################"
|
||||||
|
echo ""
|
||||||
|
echo "Please note that the exit code is not very descriptive."
|
||||||
|
echo "Most likely it will not help you solve the issue."
|
||||||
|
echo ""
|
||||||
|
echo "To find the reason for failure: please search for errors in the log above."
|
||||||
|
echo ""
|
||||||
|
fi;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Exit with code from the build step.
|
||||||
|
#
|
||||||
|
|
||||||
|
exit $BUILD_EXIT_CODE
|
||||||
39
dist/exec-child.js
vendored
Normal file
39
dist/exec-child.js
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
if (require.main !== module) {
|
||||||
|
throw new Error('This file should not be required');
|
||||||
|
}
|
||||||
|
|
||||||
|
var childProcess = require('child_process');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
var paramFilePath = process.argv[2];
|
||||||
|
|
||||||
|
var serializedParams = fs.readFileSync(paramFilePath, 'utf8');
|
||||||
|
var params = JSON.parse(serializedParams);
|
||||||
|
|
||||||
|
var cmd = params.command;
|
||||||
|
var execOptions = params.execOptions;
|
||||||
|
var pipe = params.pipe;
|
||||||
|
var stdoutFile = params.stdoutFile;
|
||||||
|
var stderrFile = params.stderrFile;
|
||||||
|
|
||||||
|
var c = childProcess.exec(cmd, execOptions, function (err) {
|
||||||
|
if (!err) {
|
||||||
|
process.exitCode = 0;
|
||||||
|
} else if (err.code === undefined) {
|
||||||
|
process.exitCode = 1;
|
||||||
|
} else {
|
||||||
|
process.exitCode = err.code;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var stdoutStream = fs.createWriteStream(stdoutFile);
|
||||||
|
var stderrStream = fs.createWriteStream(stderrFile);
|
||||||
|
|
||||||
|
c.stdout.pipe(stdoutStream);
|
||||||
|
c.stderr.pipe(stderrStream);
|
||||||
|
c.stdout.pipe(process.stdout);
|
||||||
|
c.stderr.pipe(process.stderr);
|
||||||
|
|
||||||
|
if (pipe) {
|
||||||
|
c.stdin.end(pipe);
|
||||||
|
}
|
||||||
203955
dist/index.js
generated
vendored
Normal file
203955
dist/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/index.js.map
generated
vendored
Normal file
1
dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3277
dist/licenses.txt
generated
vendored
Normal file
3277
dist/licenses.txt
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3910
dist/sourcemap-register.js
generated
vendored
Normal file
3910
dist/sourcemap-register.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
action/steps/activate.sh → dist/steps/activate.sh
vendored
Normal file → Executable file
21
action/steps/activate.sh → dist/steps/activate.sh
vendored
Normal file → Executable file
@@ -24,9 +24,7 @@ if [[ -n "$UNITY_LICENSE" ]] || [[ -n "$UNITY_LICENSE_FILE" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate license
|
# Activate license
|
||||||
ACTIVATION_OUTPUT=$(xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
ACTIVATION_OUTPUT=$(unity-editor \
|
||||||
/opt/Unity/Editor/Unity \
|
|
||||||
-batchmode \
|
|
||||||
-nographics \
|
-nographics \
|
||||||
-logFile /dev/stdout \
|
-logFile /dev/stdout \
|
||||||
-quit \
|
-quit \
|
||||||
@@ -63,15 +61,14 @@ elif [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
|
|||||||
echo "Requesting activation (professional license)"
|
echo "Requesting activation (professional license)"
|
||||||
|
|
||||||
# Activate license
|
# Activate license
|
||||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
unity-editor \
|
||||||
/opt/Unity/Editor/Unity \
|
-batchmode \
|
||||||
-batchmode \
|
-nographics \
|
||||||
-nographics \
|
-logFile /dev/stdout \
|
||||||
-logFile /dev/stdout \
|
-quit \
|
||||||
-quit \
|
-serial "$UNITY_SERIAL" \
|
||||||
-serial "$UNITY_SERIAL" \
|
-username "$UNITY_EMAIL" \
|
||||||
-username "$UNITY_EMAIL" \
|
-password "$UNITY_PASSWORD"
|
||||||
-password "$UNITY_PASSWORD"
|
|
||||||
|
|
||||||
# Store the exit code from the verify command
|
# Store the exit code from the verify command
|
||||||
UNITY_EXIT_CODE=$?
|
UNITY_EXIT_CODE=$?
|
||||||
49
action/steps/build.sh → dist/steps/build.sh
vendored
Normal file → Executable file
49
action/steps/build.sh → dist/steps/build.sh
vendored
Normal file → Executable file
@@ -48,7 +48,7 @@ if [ -z "$BUILD_METHOD" ]; then
|
|||||||
# Create Editor directory if it does not exist
|
# Create Editor directory if it does not exist
|
||||||
mkdir -p "$UNITY_PROJECT_PATH/Assets/Editor/"
|
mkdir -p "$UNITY_PROJECT_PATH/Assets/Editor/"
|
||||||
# Copy the build script of Unity Builder action
|
# Copy the build script of Unity Builder action
|
||||||
cp -r "/UnityBuilderAction/Assets/Editor" "$UNITY_PROJECT_PATH/Assets/Editor/"
|
cp -R "/UnityBuilderAction/Assets/Editor/" "$UNITY_PROJECT_PATH/Assets/Editor/"
|
||||||
# Set the Build method to that of UnityBuilder Action
|
# Set the Build method to that of UnityBuilder Action
|
||||||
BUILD_METHOD="UnityBuilderAction.Builder.BuildProject"
|
BUILD_METHOD="UnityBuilderAction.Builder.BuildProject"
|
||||||
# Verify recursive paths
|
# Verify recursive paths
|
||||||
@@ -62,6 +62,16 @@ else
|
|||||||
#
|
#
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Create Android keystore, if needed
|
||||||
|
#
|
||||||
|
if [[ -z $ANDROID_KEYSTORE_NAME || -z $ANDROID_KEYSTORE_BASE64 ]]; then
|
||||||
|
echo "Not creating Android keystore."
|
||||||
|
else
|
||||||
|
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$UNITY_PROJECT_PATH/$ANDROID_KEYSTORE_NAME"
|
||||||
|
echo "Created Android keystore."
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Display custom parameters
|
# Display custom parameters
|
||||||
#
|
#
|
||||||
@@ -98,20 +108,23 @@ echo "# Building platform #"
|
|||||||
echo "###########################"
|
echo "###########################"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
unity-editor \
|
||||||
/opt/Unity/Editor/Unity \
|
-nographics \
|
||||||
-batchmode \
|
-logfile /dev/stdout \
|
||||||
-logfile /dev/stdout \
|
-quit \
|
||||||
-quit \
|
-customBuildName "$BUILD_NAME" \
|
||||||
-customBuildName "$BUILD_NAME" \
|
-projectPath "$UNITY_PROJECT_PATH" \
|
||||||
-projectPath "$UNITY_PROJECT_PATH" \
|
-buildTarget "$BUILD_TARGET" \
|
||||||
-buildTarget "$BUILD_TARGET" \
|
-customBuildTarget "$BUILD_TARGET" \
|
||||||
-customBuildTarget "$BUILD_TARGET" \
|
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
||||||
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
-executeMethod "$BUILD_METHOD" \
|
||||||
-executeMethod "$BUILD_METHOD" \
|
-buildVersion "$VERSION" \
|
||||||
-versioning "$VERSIONING" \
|
-androidVersionCode "$ANDROID_VERSION_CODE" \
|
||||||
-version "$VERSION" \
|
-androidKeystoreName "$ANDROID_KEYSTORE_NAME" \
|
||||||
$CUSTOM_PARAMETERS
|
-androidKeystorePass "$ANDROID_KEYSTORE_PASS" \
|
||||||
|
-androidKeyaliasName "$ANDROID_KEYALIAS_NAME" \
|
||||||
|
-androidKeyaliasPass "$ANDROID_KEYALIAS_PASS" \
|
||||||
|
$CUSTOM_PARAMETERS
|
||||||
|
|
||||||
# Catch exit code
|
# Catch exit code
|
||||||
BUILD_EXIT_CODE=$?
|
BUILD_EXIT_CODE=$?
|
||||||
@@ -130,6 +143,12 @@ if [[ "$BUILD_TARGET" == "StandaloneOSX" ]]; then
|
|||||||
chmod +x $ADD_PERMISSIONS_PATH
|
chmod +x $ADD_PERMISSIONS_PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ -n "$CHOWN_FILES_TO" ]]; then
|
||||||
|
chown -R $CHOWN_FILES_TO $BUILD_PATH_FULL
|
||||||
|
chown -R $CHOWN_FILES_TO $UNITY_PROJECT_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Results
|
# Results
|
||||||
#
|
#
|
||||||
14
dist/steps/return_license.sh
vendored
Executable file
14
dist/steps/return_license.sh
vendored
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ -n "$UNITY_SERIAL" ]]; then
|
||||||
|
#
|
||||||
|
# PROFESSIONAL (SERIAL) LICENSE MODE
|
||||||
|
#
|
||||||
|
# This will return the license that is currently in use.
|
||||||
|
#
|
||||||
|
unity-editor \
|
||||||
|
-nographics \
|
||||||
|
-logFile /dev/stdout \
|
||||||
|
-quit \
|
||||||
|
-returnlicense
|
||||||
|
fi
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
const esModules = ['lodash-es'].join('|');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
clearMocks: true,
|
||||||
|
moduleFileExtensions: ['js', 'ts'],
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
|
testMatch: ['**/*.test.ts'],
|
||||||
transform: { '^.+\\.(js|jsx)?$': 'babel-jest' },
|
testRunner: 'jest-circus/runner',
|
||||||
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
|
transform: {
|
||||||
setupFilesAfterEnv: ['./src/jest.setup.js'],
|
'^.+\\.ts$': 'ts-jest',
|
||||||
|
},
|
||||||
|
verbose: true,
|
||||||
};
|
};
|
||||||
|
|||||||
1
media/Discord-Logo.svg
Normal file
1
media/Discord-Logo.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 272.1"><style>.st0{fill:#7289DA;}</style><path class="st0" d="M142.8 120.1c-5.7 0-10.2 4.9-10.2 11s4.6 11 10.2 11c5.7 0 10.2-4.9 10.2-11s-4.6-11-10.2-11zM106.3 120.1c-5.7 0-10.2 4.9-10.2 11s4.6 11 10.2 11c5.7 0 10.2-4.9 10.2-11 .1-6.1-4.5-11-10.2-11z"/><path class="st0" d="M191.4 36.9h-134c-11.3 0-20.5 9.2-20.5 20.5v134c0 11.3 9.2 20.5 20.5 20.5h113.4l-5.3-18.3 12.8 11.8 12.1 11.1 21.6 18.7V57.4c-.1-11.3-9.3-20.5-20.6-20.5zm-38.6 129.5s-3.6-4.3-6.6-8c13.1-3.7 18.1-11.8 18.1-11.8-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.4-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.6-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.2-1.8-1-2.8-1.7-2.8-1.7s4.8 7.9 17.5 11.7c-3 3.8-6.7 8.2-6.7 8.2-22.1-.7-30.5-15.1-30.5-15.1 0-31.9 14.4-57.8 14.4-57.8 14.4-10.7 28-10.4 28-10.4l1 1.2c-18 5.1-26.2 13-26.2 13s2.2-1.2 5.9-2.8c10.7-4.7 19.2-5.9 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.5 0 0-7.9-7.5-24.9-12.6l1.4-1.6s13.7-.3 28 10.4c0 0 14.4 25.9 14.4 57.8 0-.1-8.4 14.3-30.5 15zM303.8 79.7h-33.2V117l22.1 19.9v-36.2h11.8c7.5 0 11.2 3.6 11.2 9.4v27.7c0 5.8-3.5 9.7-11.2 9.7h-34v21.1h33.2c17.8.1 34.5-8.8 34.5-29.2v-29.8c.1-20.8-16.6-29.9-34.4-29.9zm174 59.7v-30.6c0-11 19.8-13.5 25.8-2.5l18.3-7.4c-7.2-15.8-20.3-20.4-31.2-20.4-17.8 0-35.4 10.3-35.4 30.3v30.6c0 20.2 17.6 30.3 35 30.3 11.2 0 24.6-5.5 32-19.9l-19.6-9c-4.8 12.3-24.9 9.3-24.9-1.4zM417.3 113c-6.9-1.5-11.5-4-11.8-8.3.4-10.3 16.3-10.7 25.6-.8l14.7-11.3c-9.2-11.2-19.6-14.2-30.3-14.2-16.3 0-32.1 9.2-32.1 26.6 0 16.9 13 26 27.3 28.2 7.3 1 15.4 3.9 15.2 8.9-.6 9.5-20.2 9-29.1-1.8l-14.2 13.3c8.3 10.7 19.6 16.1 30.2 16.1 16.3 0 34.4-9.4 35.1-26.6 1-21.7-14.8-27.2-30.6-30.1zm-67 55.5h22.4V79.7h-22.4v88.8zM728 79.7h-33.2V117l22.1 19.9v-36.2h11.8c7.5 0 11.2 3.6 11.2 9.4v27.7c0 5.8-3.5 9.7-11.2 9.7h-34v21.1H728c17.8.1 34.5-8.8 34.5-29.2v-29.8c0-20.8-16.7-29.9-34.5-29.9zm-162.9-1.2c-18.4 0-36.7 10-36.7 30.5v30.3c0 20.3 18.4 30.5 36.9 30.5 18.4 0 36.7-10.2 36.7-30.5V109c0-20.4-18.5-30.5-36.9-30.5zm14.4 60.8c0 6.4-7.2 9.7-14.3 9.7-7.2 0-14.4-3.1-14.4-9.7V109c0-6.5 7-10 14-10 7.3 0 14.7 3.1 14.7 10v30.3zM682.4 109c-.5-20.8-14.7-29.2-33-29.2h-35.5v88.8h22.7v-28.2h4l20.6 28.2h28L665 138.1c10.7-3.4 17.4-12.7 17.4-29.1zm-32.6 12h-13.2v-20.3h13.2c14.1 0 14.1 20.3 0 20.3z"/></svg>
|
||||||
|
After Width: | Height: | Size: 2.3 KiB |
65
package.json
65
package.json
@@ -1,50 +1,56 @@
|
|||||||
{
|
{
|
||||||
"name": "unity-builder",
|
"name": "unity-builder",
|
||||||
"version": "0.5.0",
|
"version": "2.0.0",
|
||||||
"description": "Build Unity projects for different platforms.",
|
"description": "Build Unity projects for different platforms.",
|
||||||
"main": "action/index.js",
|
"main": "dist/index.js",
|
||||||
"repository": "git@github.com:webbertakken/unity-builder.git",
|
"repository": "git@github.com:game-ci/unity-builder.git",
|
||||||
"author": "Webber <webber@takken.io>",
|
"author": "Webber <webber@takken.io>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "yarn",
|
"prebuild": "yarn",
|
||||||
"build": "ncc build src --out action --minify",
|
"build": "tsc && ncc build lib --source-map --license licenses.txt",
|
||||||
"lint": "prettier --check \"src/**/*.js\" && eslint src",
|
"lint": "prettier --check \"src/**/*.{js,ts}\" && eslint src/**/*.ts",
|
||||||
|
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.4",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/github": "^2.1.1"
|
"@actions/github": "^2.2.0",
|
||||||
|
"aws-sdk": "^2.812.0",
|
||||||
|
"base-64": "^1.0.0",
|
||||||
|
"kubernetes-client": "^9.0.0",
|
||||||
|
"nanoid": "3.1.20",
|
||||||
|
"semver": "^7.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "7.8.4",
|
"@types/jest": "^26.0.15",
|
||||||
"@babel/core": "7.9.6",
|
"@types/node": "^14.14.9",
|
||||||
"@babel/preset-env": "7.9.6",
|
"@types/semver": "^7.3.4",
|
||||||
"@zeit/ncc": "0.22.1",
|
"@typescript-eslint/parser": "^4.8.1",
|
||||||
"babel-eslint": "10.1.0",
|
"@vercel/ncc": "^0.25.1",
|
||||||
"eslint": "6.8.0",
|
"eslint": "^7.17.0",
|
||||||
"eslint-config-airbnb": "18.1.0",
|
"eslint-config-prettier": "^8.1.0",
|
||||||
"eslint-config-prettier": "6.11.0",
|
"eslint-plugin-github": "^4.1.1",
|
||||||
"eslint-plugin-flowtype": "4.7.0",
|
"eslint-plugin-jest": "^24.1.3",
|
||||||
"eslint-plugin-import": "2.20.2",
|
"eslint-plugin-prettier": "^3.3.1",
|
||||||
"eslint-plugin-jsx-a11y": "6.2.3",
|
"eslint-plugin-unicorn": "^28.0.2",
|
||||||
"eslint-plugin-prettier": "3.1.3",
|
|
||||||
"eslint-plugin-react": "7.19.0",
|
|
||||||
"eslint-plugin-unicorn": "19.0.1",
|
|
||||||
"husky": "4.2.5",
|
"husky": "4.2.5",
|
||||||
"jest": "25.5.3",
|
"jest": "^26.6.3",
|
||||||
"lint-staged": "10.2.2",
|
"jest-circus": "^26.6.3",
|
||||||
"lodash-es": "4.17.15",
|
"js-yaml": "^3.14.0",
|
||||||
"prettier": "2.0.5"
|
"lint-staged": "^10.5.4",
|
||||||
|
"prettier": "^2.2.1",
|
||||||
|
"ts-jest": "^26.4.4",
|
||||||
|
"typescript": "^4.1.3"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "lint-staged && yarn build && git add action/index.js"
|
"pre-commit": "lint-staged && yarn build && git add dist/index.*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{js,jsx}": [
|
"*.{js,jsx,ts,tsx}": [
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
"eslint",
|
"eslint",
|
||||||
"git add",
|
"git add",
|
||||||
@@ -53,6 +59,9 @@
|
|||||||
"*.{json,md,yaml,yml}": [
|
"*.{json,md,yaml,yml}": [
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
"git add"
|
"git add"
|
||||||
|
],
|
||||||
|
"*.sh": [
|
||||||
|
"git update-index --chmod=+x"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
23
src/index.js
23
src/index.js
@@ -1,23 +0,0 @@
|
|||||||
import { Action, BuildParameters, Cache, Docker, ImageTag } from './model';
|
|
||||||
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
async function action() {
|
|
||||||
Action.checkCompatibility();
|
|
||||||
Cache.verify();
|
|
||||||
|
|
||||||
const { dockerfile, workspace, actionFolder } = Action;
|
|
||||||
|
|
||||||
const buildParameters = await BuildParameters.create();
|
|
||||||
const baseImage = new ImageTag(buildParameters);
|
|
||||||
|
|
||||||
// Build docker image
|
|
||||||
const builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
|
||||||
|
|
||||||
// Run docker image
|
|
||||||
await Docker.run(builtImage, { workspace, ...buildParameters });
|
|
||||||
}
|
|
||||||
|
|
||||||
action().catch((error) => {
|
|
||||||
core.setFailed(error.message);
|
|
||||||
});
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user