Code Monkey home page Code Monkey logo

unity3d-gitlab-ci-example-mirror's People

Contributors

77wisher77 avatar aaulicino avatar alexfbp avatar basisbit avatar eradash avatar fanmanpro avatar fillefilip8 avatar gableroux avatar gris-martin avatar imerr avatar initfusion avatar johanhelsing avatar kakious avatar katoha avatar lippok avatar poqatj avatar shadow7412 avatar snim2 avatar theosabattie avatar webbertakken avatar wissevrowl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity3d-gitlab-ci-example-mirror's Issues

Draft: completely scripted activation

Hey there,

since all your content has helped me alot with setting up dockerized unity I wanted to share my working approach to activating unity by script.

node/puppeteer script:

const puppeteer = require('puppeteer');
const fs = require('fs');

try {
    fs.mkdirSync('debug_images');
    console.log('created debug folder.');

} catch (e) {
    console.log('debug folder already present.');
}


(async () => {

    const browser = await puppeteer.launch({
        args: ["--no-sandbox"]
    });
    const page = await browser.newPage();

    // open manual page & wait for login redirect

	await page.goto('https://license.unity3d.com/manual');

	const mailInputSelector = '#conversations_create_session_form_email',
		  passInputSelector = '#conversations_create_session_form_password';

	await page.waitForSelector(mailInputSelector);

    // enter credentials

	await page.type(mailInputSelector, process.env.UNITY_USERNAME);
	await page.type(passInputSelector, process.env.UNITY_PASSWORD);

	await page.screenshot({ path: 'debug_images/01_entered_credentials.png' });

    // click submit

	await page.click('input[name=commit]');

    // wait for license upload form

	const licenseUploadfield = '#licenseFile';

	await page.waitForSelector(licenseUploadfield);

	await page.screenshot({ path: 'debug_images/02_opened_form.png' });

    // enalbe interception
    
	await page.setRequestInterception(true);

    // upload license

	page.once("request", interceptedRequest => {
		
        interceptedRequest.continue({
            method: "POST",
            postData: fs.readFileSync(process.env.UNITY_ACTIVATION_FILE, 'utf8'),
            headers: { "Content-Type": "text/xml" },
        });

	});

	await page.goto('https://license.unity3d.com/genesis/activation/create-transaction');

	await page.screenshot({ path: 'debug_images/03_created_transaction.png' });

    // set license to be personal

    page.once("request", interceptedRequest => {
        interceptedRequest.continue({
            method: "PUT",
            postData: JSON.stringify({ transaction: { serial: { type: "personal" } } }),
            headers: { "Content-Type": "application/json" }
        });
    });

	await page.goto('https://license.unity3d.com/genesis/activation/update-transaction');

    await page.screenshot({ path: 'debug_images/04_updated_transaction.png' });
    
    // get license content

    page.once("request", interceptedRequest => {
        interceptedRequest.continue({
            method: "POST",
            postData: JSON.stringify({}),
            headers: { "Content-Type": "application/json" }
        });
    });

    page.on('response', async response => {  
                
        // write license

        try {
            const data = await response.text();
            const dataJson = await JSON.parse(data);
            fs.writeFileSync(process.env.UNITY_LICENSE_FILE, dataJson.xml);
            console.log('license file written.');

            await page.screenshot({ path: 'debug_images/05_received_license.png' });
            
        } catch (e) {
            console.log(e);
            console.log('failed to write license file.');
        }

    });

    await page.goto('https://license.unity3d.com/genesis/activation/download-license');
    await page.waitFor(1000);
    await browser.close();



})();

And then there's just a small shell script handling the rest. Please note that (only?) Unity 2018.3 cli supports manual generation of activation file, which comes in handy here.

#!/bin/sh

xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
  /opt/Unity/Editor/Unity -batchmode -createManualActivationFile -nographics -logfile

find -name "Unity*" -exec mv {} ../$UNITY_ACTIVATION_FILE \;
if [ $? -ne 0 ]
then
    echo "error while preparing generated license activation file."
	exit 3
fi


cd ../

# run puppeteer activation macro
node index.js
if [ $? -ne 0 ]
then
    echo "error while retrieving license."
	exit 3
fi

mv $UNITY_LICENSE_FILE /root/.local/share/unity3d/Unity/

if [ $? -eq 0 ]
then
    echo "license file installed."
	exit 0
fi

Involved env vars:

[email protected]
UNITY_PASSWORD=XXXXXXXXXXXXX
UNITY_ACTIVATION_FILE=unity3d.alf
UNITY_LICENSE_FILE=Unity_lic.ulf

You might want to take a look at how to implement this into your images 👍

Best
Alex

Request: UWP windows based image

I want to add my CI generation of .appx for Hololens2 Microsoft headset.
Maybe you have it on your docker images development roadmap?

Almog

circleci - /bin/bash: git: command not found

hitting this. any ideas?

tim@DESKTOP-HUCQDLR:~/ursaLeo/unity-test$ circleci local execute -c process.yml --job unity-ci/outputAlf
Docker image digest: sha256:2c2fd6a4655b259ac40f3c168b82200d4a7cebdc8287c4eb866a348b0191403d
====>> Spin Up Environment
Build-agent version  ()
Docker Engine Version: 19.03.8
Kernel Version: Linux 7b2fb95aeee5 4.19.84-microsoft-standard #1 SMP Wed Nov 13 11:44:37 UTC 2019 x86_64 Linux
Starting container gableroux/unity3d:2019.1.0f2
  image is cached as gableroux/unity3d:2019.1.0f2, but refreshing...
2019.1.0f2: Pulling from gableroux/unity3d
Digest: sha256:b4f3bb32e1c92f671dbf9a197250870f84755c1d968b8612925d851c9b46517d
Status: Image is up to date for gableroux/unity3d:2019.1.0f2
  using image gableroux/unity3d@sha256:b4f3bb32e1c92f671dbf9a197250870f84755c1d968b8612925d851c9b46517d
====>> Preparing Environment Variables
Using build environment variables:
  BASH_ENV=/tmp/.bash_env-localbuild-1584369042
  CI=true
  CIRCLECI=true
  CIRCLE_BRANCH=master
  CIRCLE_BUILD_NUM=
  CIRCLE_JOB=unity-ci/outputAlf
  CIRCLE_NODE_INDEX=0
  CIRCLE_NODE_TOTAL=1
  CIRCLE_REPOSITORY_URL=https://github.com/UrsaLeo/unity-test.git
  CIRCLE_SHA1=3b9d1c754d2f86785de31ef566dd0315a8e9fbc1
  CIRCLE_SHELL_ENV=/tmp/.bash_env-localbuild-1584369042
  CIRCLE_WORKING_DIRECTORY=~/project


The redacted variables listed above will be masked in run step output.====>> Setup a remote Docker engine
{"Runner":true,"level":"error","msg":"running as root","task-id":"localbuild-1584369042","time":"2020-03-16T14:30:45Z"}
Using local docker engine bind-mounted
====>> Checkout code
  #!/bin/bash -eo pipefail
mkdir -p /root/project && cd /tmp/_circleci_local_build_repo && git ls-files | tar -T - -c | tar -x -C /root/project && cp -a /tmp/_circleci_local_build_repo/.git /root/project
/bin/bash: git: command not found
Error:
Exited with code exit status 127

Step failed
Error: runner failed (exited with 101)
Task failed
Error: task failed

my .yml:

version: 2.1

orbs:
  unity-ci: mizotake/[email protected]

executors:
  unity_executor:
    docker:
      - image: gableroux/unity3d:2019.1.0f2

workflows:
  version: 2
  unity-ci-activate-ulf-file:
    jobs:
      - unity-ci/outputAlf:
          exec: unity_executor
tim@DESKTOP-HUCQDLR:~$ circleci version
0.1.6949+d951526
tim@DESKTOP-HUCQDLR:~$ circleci diagnostic

---
CircleCI CLI Diagnostics
---
Debugger mode: false
Config found: /home/tim/.circleci/cli.yml
API host: https://circleci.com
API endpoint: graphql-unstable
Error: please set a token with 'circleci setup'
You can create a new personal API token here:
https://circleci.com/account/api

This looks awesome. Any pitfalls with github actions?

Currently were using Unity Cloud Build in our process which has been working well. Looking to move everything over to github though and this looks like exactly what were looking for.

Any plans to do a poc using github actions?

Deploy to github-pages with travis

Travis support is now working. Project is being correctly built and it's only missing a job in .travis.yml to automatically push to gh-pages with the webgl artifact to deploy to github-pages

Here's the related documentation to accomplish this:
https://docs.travis-ci.com/user/deployment/pages/

We will need build stages

The deploy job will need to run after the webgl build success and deploy the artifact stored in ./Builds/WebGL/.

Draft

- stage: deploy
  if: type = push AND branch = master OR branch = feature/gh-pages # temporary branch to test the deployment
  script: skip
  deploy:
    - provider: pages
      skip_cleanup: true
      github_token: $GH_TOKEN  # Set in the settings page of your repository, as a secure variable
      keep_history: true
      local_dir: ./Builds/WebGL/

Licensing::Module] License is not active (com.unity.editor.ui). HasEntitlements will fail.

I'm running a Unity Build within an Ubuntu container based on your Dockerfile. The error in the title is all over the place in the logs and I'm not exactly sure what's causing it. Would you have any ideas? I may be running into this issue.

Here's the full build command:

RUN xvfb-run --auto-servernum --server-args="-screen 0 640x480x24" /unity/Editor/Unity -projectPath /project -quit -batchmode -buildTarget webgl -serial "${UNITY_SERIAL}" -username "${UNITY_USER}" -password "${UNITY_PASS}" -executeMethod BuildUtils.BuildWithParams 

any help would be appreciated.

Thanks

Unity installation proposal

Hello! I have investigated Unity installation on CI (https://github.com/KonH/UnityCiPipeline) and found a nice tool for it - https://github.com/DragonBox/u3d. It provides the ability to install all available Unity versions without manual link and checksum management.
I think it can improve your project usability in some way.
In my approach required version of Unity (detected by ProjectVersion.txt) is installed on every build, because I don't want to have several versions of my docker container. But I don't think that it is a good idea in common (build time noticeable increased), so you can implement it into your CI generator to support more versions.
I hope this information will be useful to you.

Docker container unity3d:2019.3.0f6 missing platforms support

Steps:

  1. Run docker run -it gableroux/unity3d:2019.3.0f6
  2. Once machine as started run ls /opt/Unity/Editor/Data/PlaybackEngines/
    image
    Only the linux standalone support is available I was expecting all the platforms supported.
    If that is not possible I would expect more containers in here so that you can have more options like:
    unity3d:2019.3.0f6-window-osx
    unity3d:2019.3.0f6-linux-osx
    unity3d:2019.3.0f6-linux-window-osx

I'm following this tutorial but using the latest unity version at the moment.

P.S I didn't know where to raise this in the docker platform

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.