Skip to content

Commit 44fd1db

Browse files
committed
feat(CI): Added files for CI and semantic release
1 parent 85ab306 commit 44fd1db

15 files changed

+270
-0
lines changed

.bumpversion.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[bumpversion]
2+
current_version = 0.0.1
3+
commit = True
4+
message = [skip ci] docs: Update version numbers from {current_version} -> {new_version}
5+
6+
[bumpversion:file:Utilities/Constants.cs]
7+
search = {current_version}
8+
replace = {new_version}

.releaserc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"branch": "master",
3+
"verifyConditions": ["@semantic-release/changelog", "@semantic-release/git", "@semantic-release/exec"],
4+
"prepare": [
5+
"@semantic-release/changelog",
6+
"@semantic-release/git",
7+
{
8+
"path": "@semantic-release/exec",
9+
"cmd": "bumpversion --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch"
10+
}
11+
],
12+
"publish": ["@semantic-release/github"]
13+
}

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
language: node_js
2+
node_js:
3+
- "8.3"
4+
os:
5+
- osx
6+
osx_image: xcode61
7+
rvm:
8+
- 2.2
9+
cache:
10+
directories:
11+
- ./Unity
12+
before_install:
13+
- chmod a+x ./Travis/installUnity.sh
14+
- chmod a+x ./Travis/createProject.sh
15+
- chmod a+x ./Travis/installSDK.sh
16+
- chmod a+x ./Travis/runTests.sh
17+
- npm install -g [email protected]
18+
install:
19+
- pip install bumpversion
20+
- npm install @semantic-release/exec
21+
- npm install @semantic-release/changelog
22+
- npm install @semantic-release/git
23+
- npm install @semantic-release/github
24+
- ./Travis/installUnity.sh
25+
script:
26+
- ./Travis/createProject.sh
27+
- ./Travis/installSDK.sh
28+
- ./Travis/runTests.sh
29+
deploy:
30+
- provider: script
31+
skip_cleanup: true
32+
script: npx semantic-release

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# IBM Cloud Unity SDK Core
2+
[![Build Status](https://travis-ci.org/IBM/unity-sdk-core.svg?branch=master)](https://travis-ci.org/IBM/unity-sdk-core/)
3+
[![wdc-community.slack.com](https://wdc-slack-inviter.mybluemix.net/badge.svg)](http://wdc-slack-inviter.mybluemix.net/)
4+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
5+
[![CLA assistant](https://cla-assistant.io/readme/badge/IBM/unity-sdk-core)](https://cla-assistant.io/IBM/unity-sdk-core)
6+
7+
The IBM Cloud Unity SDK Core is a core project of Unity SDKs generated using the IBM OpenAPI SDK generator. Generated services should use this package as a submodule of their generate Unity SDK.
8+
9+
<details>
10+
<summary>Table of Contents</summary>
11+
12+
* [Before you begin](#before-you-begin)
13+
* [Configuring Unity](#configuring-unity)
14+
* [Getting the IBM Cloud Unity SDK Core and adding it to Unity](#getting-the-ibm-unity-sdk-core-and-adding-it-to-unity)
15+
* [Questions](#questions)
16+
* [Open Source @ IBM](#open-source--ibm)
17+
* [License](#license)
18+
* [Contributing](#contributing)
19+
20+
</details>
21+
22+
## Before you begin
23+
Ensure that you have the following prerequisites:
24+
25+
* [Unity][get_unity]. You can use the **free** Personal edition.
26+
27+
## Configuring Unity
28+
* Change the build settings in Unity (**File > Build Settings**) to any platform except for web player/Web GL. The IBM Watson SDK for Unity does not support Unity Web Player.
29+
* If using Unity 2018.2 or later you'll need to set **Scripting Runtime Version** and **Api Compatibility Level** in Build Settings to **.NET 4.x equivalent**. We need to access security options to enable TLS 1.2.
30+
31+
## Getting the IBM Unity SDK Core and adding it to Unity
32+
The IBM Unity SDK Core is mean to be used as a submodule in other generated Unity SDKs. The selected SDK release will point to a particular commit of the IBM Unity SDK Core. Clone the SDK into your Unity project's Assets directory, and initalize and update submodules.
33+
34+
```bash
35+
$ git clone [unity-sdk-url]
36+
$ cd [unity-sdk-directory]
37+
$ git submodule init
38+
$ git submodule update
39+
```
40+
41+
## Questions
42+
43+
If you are having difficulties using the APIs or have a question about the IBM Watson Services, please ask a question on
44+
[dW Answers](https://developer.ibm.com/answers/questions/ask/?topics=watson)
45+
or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).
46+
47+
## Open Source @ IBM
48+
Find more open source projects on the [IBM Github Page](http://ibm.github.io/).
49+
50+
## License
51+
This library is licensed under Apache 2.0. Full license text is available in [LICENSE](LICENSE).
52+
53+
## Contributing
54+
See [CONTRIBUTING.md](.github/CONTRIBUTING.md).
55+
56+
[get_unity]: https://unity3d.com/get-unity

README.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Travis.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Travis/createProject.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#! /bin/sh
2+
project="unity-sdk-travis"
3+
4+
echo "Attempting to create directory for empty project Travis/UnityTestProject..."
5+
mkdir -p Travis/UnityTestProject
6+
7+
echo "Attempting to create an empty project into Travis/UnityTestProject...."
8+
/Applications/Unity/Unity.app/Contents/MacOS/Unity \
9+
-batchmode \
10+
-nographics \
11+
-silent-crashes \
12+
-logFile $(pwd)/createProject.log \
13+
-createProject $(pwd)/Travis/UnityTestProject \
14+
-quit
15+
if [ $? = 0 ] ; then
16+
echo "Project creation COMPLETED! Exited with $?"
17+
exit 0
18+
else
19+
echo "Project creation FAILED! Exited with $?"
20+
echo 'Logs create project'
21+
cat $(pwd)/createProject.log
22+
exit 1
23+
fi

Travis/createProject.sh.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Travis/installSDK.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#! /bin/sh
2+
project="unity-sdk-travis"
3+
4+
echo "Attempting to install IBM Unity SDK Core into the test project..."
5+
mkdir -p Travis/UnityTestProject/Assets/Watson/Core
6+
git clone -b $TRAVIS_BRANCH https://github.com/IBM/unity-sdk-core.git Travis/UnityTestProject/Assets/Watson/Core
7+
8+
if [ $? = 0 ] ; then
9+
echo "IBM Unity SDK Core install SUCCEEDED! Exited with $?"
10+
11+
echo "Attempting to create Travis/UnityTestProject/Assets/Scripts/Editor/"
12+
mkdir -p Travis/UnityTestProject/Assets/Scripts/Editor/
13+
if [ $? = 0 ] ; then
14+
echo "Creating Travis/UnityTestProject/Assets/Scripts/Editor/ SUCCEEDED! Exited with $?"
15+
else
16+
echo "Creating Travis/UnityTestProject/Assets/Scripts/Editor/ FAILED! EXITED WITH $?"
17+
fi
18+
else
19+
echo "WDC Unity SDK install FAILED! Exited with $?"
20+
exit 1
21+
fi

Travis/installSDK.sh.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Travis/installUnity.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#! /bin/sh
2+
3+
set -e
4+
5+
BASE_URL=https://netstorage.unity3d.com/unity
6+
HASH=83fbdcd35118
7+
VERSION=2018.2.13f1
8+
9+
download() {
10+
file=$1
11+
url="$BASE_URL/$HASH/$package"
12+
13+
echo "Downloading from $url: "
14+
cd Unity
15+
curl -o `basename "$package"` "$url"
16+
cd ../
17+
}
18+
19+
install() {
20+
package=$1
21+
filename=`basename "$package"`
22+
packagePath="Unity/$filename"
23+
if [ ! -f $packagePath ] ; then
24+
echo "$packagePath not found. downloading `basename "$packagePath"`"
25+
download "$package"
26+
fi
27+
28+
echo "Installing "`basename "$package"`
29+
sudo installer -dumplog -package $packagePath -target /
30+
}
31+
32+
if [ ! -d "Unity" ] ; then
33+
mkdir -p -m 777 Unity
34+
fi
35+
36+
install "MacEditorInstaller/Unity-$VERSION.pkg"

Travis/installUnity.sh.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Travis/runTests.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#! /bin/sh
2+
3+
set -e
4+
5+
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
6+
echo '$TRAVIS_PULL_REQUEST is false, running tests'
7+
8+
echo "Attempting to run IBM Unity SDK Core Tests..."
9+
/Applications/Unity/Unity.app/Contents/MacOS/Unity \
10+
-batchmode \
11+
-runEditorTests \
12+
-logFile $(pwd)/integrationTests.log \
13+
-projectPath $(pwd)/Travis/UnityTestProject \
14+
-testPlatform playmode \
15+
-testResults $(pwd)/test-results.xml \
16+
-editorTestsResultFile $(pwd)/test-results.xml \
17+
-quit
18+
19+
if [ $? = 0 ] ; then
20+
echo "Tests COMPLETED! Exited with $?"
21+
echo 'Test logs'
22+
cat $(pwd)/integrationTests.log
23+
cat $(pwd)/test-results.xml
24+
exit 0
25+
else
26+
echo "Tests FAILED! Exited with $?"
27+
echo 'Test logs'
28+
cat $(pwd)/integrationTests.log
29+
cat $(pwd)/test-results.xml
30+
exit 1
31+
fi
32+
else
33+
echo '$TRAVIS_PULL_REQUEST is not false ($TRAVIS_PULL_REQUEST), skipping tests'
34+
fi

Travis/runTests.sh.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Utilities/Constants.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public static class String
5252
/// URL for IBM Cloud onboarding
5353
/// </summary>
5454
public const string IBM_CLOUD_URL = "http://console.bluemix.net/registration";
55+
/// <summary>
56+
/// The version of the Unity SDK Core
57+
/// </summary>
58+
public const string CORE_VERSION = "0.0.1";
5559
}
5660

5761
/// <summary>

0 commit comments

Comments
 (0)