License Activation fixes and Github Annotations (#590)

* Ensure serial is prioritized

* Add compile listener to create github annotations

* Update node modules

* Don't build ubuntu on PR as secrets are now needed. Update PR template to request an example successful run. Remove 32bit windows build. Build on push to any branch

* Update activation to use blank project

* Ensure exceptions get annotated as well

* More robust console printing

* Update test project

* Build iOS test on macos to verify burst functionality. Add annotation for license activation error. Fix unity version test. Remove minification from android

* Improve license checks

* Mask partially redacted serial in addition to full serial

* Add retry logic to ubuntu builds

* Allow dirty build on retry

* Bump unity version
This commit is contained in:
Andrew Kahr
2023-11-12 05:47:03 -08:00
committed by GitHub
parent 7afabe74da
commit caa0a81b47
45 changed files with 4365 additions and 3019 deletions

View File

@@ -12,6 +12,7 @@ import { Cli } from './cli/cli';
import GitHub from './github';
import CloudRunnerOptions from './cloud-runner/options/cloud-runner-options';
import CloudRunner from './cloud-runner/cloud-runner';
import * as core from '@actions/core';
class BuildParameters {
// eslint-disable-next-line no-undef
@@ -132,6 +133,11 @@ class BuildParameters {
}
}
if (unitySerial !== undefined && unitySerial.length === 27) {
core.setSecret(unitySerial);
core.setSecret(`${unitySerial.slice(0, -4)}XXXX`);
}
return {
editorVersion,
customImage: Input.customImage,

View File

@@ -62,7 +62,6 @@ class Docker {
--workdir ${dockerWorkspacePath} \
--rm \
${ImageEnvironmentFactory.getEnvVarString(parameters, additionalVariables)} \
--env UNITY_SERIAL \
--env GITHUB_WORKSPACE=${dockerWorkspacePath} \
--env GIT_CONFIG_EXTENSIONS \
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
@@ -74,6 +73,7 @@ class Docker {
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
--volume "${actionFolder}/unity-config:/usr/share/unity3d/config/:z" \
--volume "${actionFolder}/BlankProject":"/BlankProject:z" \
--cpus=${dockerCpuLimit} \
--memory=${dockerMemoryLimit} \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
@@ -93,7 +93,6 @@ class Docker {
const {
workspace,
actionFolder,
unitySerial,
gitPrivateToken,
dockerWorkspacePath,
dockerCpuLimit,
@@ -105,7 +104,6 @@ class Docker {
--workdir c:${dockerWorkspacePath} \
--rm \
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
--env UNITY_SERIAL="${unitySerial}" \
--env GITHUB_WORKSPACE=c:${dockerWorkspacePath} \
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
--volume "${workspace}":"c:${dockerWorkspacePath}" \

View File

@@ -1,4 +1,3 @@
import { ReadLicense } from './input-readers/test-license-reader';
import { DockerParameters, StringKeyValuePair } from './shared-types';
class ImageEnvironmentFactory {
@@ -23,14 +22,18 @@ class ImageEnvironmentFactory {
public static getEnvironmentVariables(parameters: DockerParameters, additionalVariables: StringKeyValuePair[] = []) {
let environmentVariables: StringKeyValuePair[] = [
{ name: 'UNITY_LICENSE', value: process.env.UNITY_LICENSE || ReadLicense() },
{ name: 'UNITY_LICENSE_FILE', value: process.env.UNITY_LICENSE_FILE },
{ name: 'UNITY_EMAIL', value: process.env.UNITY_EMAIL },
{ name: 'UNITY_PASSWORD', value: process.env.UNITY_PASSWORD },
{ name: 'UNITY_SERIAL', value: parameters.unitySerial },
{ name: 'UNITY_LICENSING_SERVER', value: parameters.unityLicensingServer },
{
name: 'UNITY_LICENSING_SERVER',
value: parameters.unityLicensingServer,
},
{ name: 'UNITY_VERSION', value: parameters.editorVersion },
{ name: 'USYM_UPLOAD_AUTH_TOKEN', value: process.env.USYM_UPLOAD_AUTH_TOKEN },
{
name: 'USYM_UPLOAD_AUTH_TOKEN',
value: process.env.USYM_UPLOAD_AUTH_TOKEN,
},
{ name: 'PROJECT_PATH', value: parameters.projectPath },
{ name: 'BUILD_TARGET', value: parameters.targetPlatform },
{ name: 'BUILD_NAME', value: parameters.buildName },
@@ -41,12 +44,21 @@ class ImageEnvironmentFactory {
{ name: 'VERSION', value: parameters.buildVersion },
{ name: 'ANDROID_VERSION_CODE', value: parameters.androidVersionCode },
{ name: 'ANDROID_KEYSTORE_NAME', value: parameters.androidKeystoreName },
{ name: 'ANDROID_KEYSTORE_BASE64', value: parameters.androidKeystoreBase64 },
{
name: 'ANDROID_KEYSTORE_BASE64',
value: parameters.androidKeystoreBase64,
},
{ name: 'ANDROID_KEYSTORE_PASS', value: parameters.androidKeystorePass },
{ name: 'ANDROID_KEYALIAS_NAME', value: parameters.androidKeyaliasName },
{ name: 'ANDROID_KEYALIAS_PASS', value: parameters.androidKeyaliasPass },
{ name: 'ANDROID_TARGET_SDK_VERSION', value: parameters.androidTargetSdkVersion },
{ name: 'ANDROID_SDK_MANAGER_PARAMETERS', value: parameters.androidSdkManagerParameters },
{
name: 'ANDROID_TARGET_SDK_VERSION',
value: parameters.androidTargetSdkVersion,
},
{
name: 'ANDROID_SDK_MANAGER_PARAMETERS',
value: parameters.androidSdkManagerParameters,
},
{ name: 'ANDROID_EXPORT_TYPE', value: parameters.androidExportType },
{ name: 'ANDROID_SYMBOL_TYPE', value: parameters.androidSymbolType },
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
@@ -86,7 +98,9 @@ class ImageEnvironmentFactory {
}
}
}
if (parameters.sshAgent) environmentVariables.push({ name: 'SSH_AUTH_SOCK', value: '/ssh-agent' });
if (parameters.sshAgent) {
environmentVariables.push({ name: 'SSH_AUTH_SOCK', value: '/ssh-agent' });
}
return environmentVariables;
}

View File

@@ -7,9 +7,9 @@ describe('Unity Versioning', () => {
});
it('parses from ProjectVersion.txt', () => {
const projectVersionContents = `m_EditorVersion: 2019.2.11f1
m_EditorVersionWithRevision: 2019.2.11f1 (5f859a4cfee5)`;
expect(UnityVersioning.parse(projectVersionContents)).toBe('2019.2.11f1');
const projectVersionContents = `m_EditorVersion: 2021.3.4f1
m_EditorVersionWithRevision: 2021.3.4f1 (cb45f9cae8b7)`;
expect(UnityVersioning.parse(projectVersionContents)).toBe('2021.3.4f1');
});
});
@@ -19,13 +19,13 @@ describe('Unity Versioning', () => {
});
it('reads from test-project', () => {
expect(UnityVersioning.read('./test-project')).toBe('2019.2.11f1');
expect(UnityVersioning.read('./test-project')).toBe('2021.3.4f1');
});
});
describe('determineUnityVersion', () => {
it('defaults to parsed version', () => {
expect(UnityVersioning.determineUnityVersion('./test-project', 'auto')).toBe('2019.2.11f1');
expect(UnityVersioning.determineUnityVersion('./test-project', 'auto')).toBe('2021.3.4f1');
});
it('use specified unityVersion', () => {