Skip to content

Commit e6f7925

Browse files
committed
chore(tests): setup tests through circleci
1 parent 2cff118 commit e6f7925

8 files changed

Lines changed: 108 additions & 8 deletions

File tree

.circleci/config.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: 2.1
2+
executors:
3+
unity-2019:
4+
docker:
5+
- image: gableroux/unity3d:2019.3.6f1
6+
environment:
7+
UNITY_LICENSE_CONTENT_VAR: UNITY_LICENSE_CONTENT_2019_3_6
8+
9+
.test-2019: &test-2019
10+
executor: unity-2019
11+
steps:
12+
- checkout
13+
- run:
14+
name: Preparing Unity
15+
command: chmod +x ./.circleci/scripts/prepare_unity.sh && ./.circleci/scripts/prepare_unity.sh
16+
- run:
17+
name: Running tests
18+
command: chmod +x ./.circleci/scripts/run_unity_tests.sh && ./.circleci/scripts/run_unity_tests.sh
19+
- store_test_results:
20+
path: test-results
21+
22+
jobs:
23+
test-editmode-2019:
24+
<<: *test-2019
25+
environment:
26+
TEST_PLATFORM: editmode
27+
test-playmode-2019:
28+
<<: *test-2019
29+
environment:
30+
TEST_PLATFORM: playmode
31+
32+
workflows:
33+
version: 2
34+
test:
35+
jobs:
36+
- test-editmode-2019:
37+
context: Unity
38+
- test-playmode-2019:
39+
context: Unity

.circleci/scripts/prepare_unity.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
mkdir -p /root/.cache/unity3d
7+
mkdir -p /root/.local/share/unity3d/Unity/
8+
9+
set +x
10+
11+
echo "Extracting Unity license file..."
12+
UNITY_LICENSE_CONTENT="${!UNITY_LICENSE_CONTENT_VAR}"
13+
echo "$UNITY_LICENSE_CONTENT" | base64 --decode | tr -d '\r' > /root/.local/share/unity3d/Unity/Unity_lic.ulf
14+
15+
echo "Building Unity project..."
16+
PROJECT_ROOT=$(pwd)
17+
PACKAGE_DEST="$PROJECT_ROOT/Packages/UnityMeshSimplifier"
18+
mkdir -p "$PACKAGE_DEST"
19+
mv Editor "$PACKAGE_DEST/Editor"
20+
mv Runtime "$PACKAGE_DEST/Runtime"
21+
22+
mkdir "$PROJECT_ROOT/Assets"
23+
mkdir "$PROJECT_ROOT/Library"
24+
mkdir "$PROJECT_ROOT/ProjectSettings"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
5+
echo "Testing for $TEST_PLATFORM"
6+
7+
PROJECT_ROOT="$(pwd)"
8+
TEST_RESULT_DIR="$PROJECT_ROOT/test-results/nunit"
9+
TEST_RESULT_FILE_NAME="$TEST_PLATFORM-results.xml"
10+
TEST_RESULT_FILE_PATH="$TEST_RESULT_DIR/$TEST_RESULT_FILE_NAME"
11+
${UNITY_EXECUTABLE:-xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity} \
12+
-projectPath "$PROJECT_ROOT" \
13+
-runTests \
14+
-testPlatform $TEST_PLATFORM \
15+
-testResults "$TEST_RESULT_FILE_PATH" \
16+
-logFile - \
17+
-batchmode
18+
19+
UNITY_EXIT_CODE=$?
20+
21+
if [ $UNITY_EXIT_CODE -eq 0 ]; then
22+
echo "Run succeeded, no failures occurred";
23+
elif [ $UNITY_EXIT_CODE -eq 2 ]; then
24+
echo "Run succeeded, some tests failed";
25+
elif [ $UNITY_EXIT_CODE -eq 3 ]; then
26+
echo "Run failure (other failure)";
27+
else
28+
echo "Unexpected exit code $UNITY_EXIT_CODE";
29+
fi
30+
31+
cat "$TEST_RESULT_FILE_PATH" | grep test-run | grep Passed
32+
exit $UNITY_TEST_EXIT_CODE

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ insert_final_newline = true
1010
[*.md]
1111
indent_style = space
1212
indent_size = 2
13+
14+
[*.yml]
15+
indent_style = space
16+
indent_size = 2

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ If applicable, add screenshots to help explain your problem.
2525

2626
**Environment (please complete the following information):**
2727
- OS: [e.g. Mac OS]
28-
- Unity Version [e.g. 2019.3.4f1]
28+
- Unity Version: [e.g. 2019.3.4f1]
2929

3030
**Additional context**
3131
Add any other context about the problem here.

.github/workflows/commit_message_check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 'Commit Message Check'
22
on:
33
push:
44
branches:
5-
- master
5+
- '*'
66

77
jobs:
88
check-commit-message:
@@ -17,5 +17,5 @@ jobs:
1717
- name: Check Line Length
1818
uses: gsactions/commit-message-checker@v1
1919
with:
20-
pattern: '^.{1,72}(?:\n.{0,72})*$'
20+
pattern: '^.{1,72}(?:\n.{0,100})*$'
2121
error: 'The maximum line length of 100 characters is exceeded.'

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Every commit must specify at least a **type** and a **subject**. While **scope**
4343
<footer>
4444
```
4545

46-
Any line of the commit message cannot be longer than 72 characters, in order for them to be easy to read in varios git tools.
46+
Any line of the commit message cannot be longer than 100 characters (with the header being maximum 72 characters), in order for them to be easy to read in varios git tools.
4747

4848
**Examples:**
4949

@@ -62,7 +62,7 @@ docs(readme): added more detailed examples to the readme
6262

6363
All supported commit types:
6464

65-
* **chore**: Changes made to the CI configuration files and scripts.
65+
* **chore**: Changes that aren't relevant to a release.
6666
* **ci**: Changes made to the CI configuration files and scripts.
6767
* **docs**: Changes to documentation.
6868
* **feat**: A new feature.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
[![openupm](https://img.shields.io/npm/v/com.whinarn.unitymeshsimplifier?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.whinarn.unitymeshsimplifier/)
44
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3c6b55bddfe64912b56e6759c642939d)](https://www.codacy.com/manual/Whinarn/UnityMeshSimplifier?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Whinarn/UnityMeshSimplifier&amp;utm_campaign=Badge_Grade)
5-
[![Release](https://github.com/Whinarn/UnityMeshSimplifier/workflows/Release/badge.svg)](https://github.com/Whinarn/UnityMeshSimplifier/actions?query=workflow%3ARelease)
5+
[![CircleCI](https://img.shields.io/circleci/build/gh/Whinarn/UnityMeshSimplifier?label=circle-ci)](https://circleci.com/gh/Whinarn/UnityMeshSimplifier/tree/master)
6+
[![GitHub Release Status](https://img.shields.io/github/workflow/status/Whinarn/UnityMeshSimplifier/Release?label=release)](https://github.com/Whinarn/UnityMeshSimplifier/actions?query=workflow%3ARelease)
67
[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/Whinarn/UnityMeshSimplifier/blob/master/LICENSE.md)
8+
[![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)
79

810
Mesh simplification for [Unity](https://unity3d.com/). The project is deeply based on the [Fast Quadric Mesh Simplification](https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification) algorithm, but rewritten entirely in C# and released under the MIT license.
911

@@ -49,8 +51,7 @@ You can use [OpenUPM](https://openupm.com/) to install UnityMeshSimplifier.
4951
"com.whinarn.unitymeshsimplifier": "https://github.com/Whinarn/UnityMeshSimplifier.git",
5052
"com.unity.burst": "1.0.4",
5153
"com.unity.mathematics": "1.0.1",
52-
"com.unity.package-manager-ui": "2.1.2",
53-
...
54+
"com.unity.package-manager-ui": "2.1.2"
5455
}
5556
}
5657
```

0 commit comments

Comments
 (0)