Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

Commit 09db0f0

Browse files
author
Jamie Brynes
authored
Feature/linting (#88)
1 parent a8a7273 commit 09db0f0

File tree

8 files changed

+120
-28
lines changed

8 files changed

+120
-28
lines changed

.buildkite/premerge.steps.yaml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# You may find the example pipeline steps listed here helpful: https://buildkite.com/docs/pipelines/defining-steps#example-pipeline but please
88
# note that the setup is already done, so you should not manually adjust anything through the BuildKite interface.
99
#
10-
common: &common
10+
windows: &windows
1111
agents:
1212
- "capable_of_building=gdk-for-unity"
1313
- "environment=production"
@@ -45,13 +45,33 @@ macos: &macos
4545
- exit_status: -1
4646
limit: 3
4747

48+
linux: &linux
49+
agents:
50+
- "capable_of_building=gdk-for-unity"
51+
- "environment=production"
52+
- "permission_set=builder"
53+
- "platform=linux" # if you need a different platform, configure this: macos|linux|windows.
54+
- "queue=v3-1562766449-11b126f880607f28-------z"
55+
- "scaler_version=2"
56+
timeout_in_minutes: 60 # TODO(ENG-548): reduce timeout once agent-cold-start is optimised.
57+
retry:
58+
automatic:
59+
# This is designed to trap and retry failures because agent lost connection. Agent exits with -1 in this case.
60+
- exit_status: -1
61+
limit: 3
62+
63+
4864
# NOTE: step labels turn into commit-status names like {org}/{repo}/{pipeline}/{step-label}, lower-case and hyphenated.
4965
# These are then relied on to have stable names by other things, so once named, please beware renaming has consequences.
5066

5167
steps:
68+
- label: ":debian: ~ lint :lint-roller:"
69+
command: bash -c ci/lint.sh
70+
<<: *linux
71+
5272
- label: ":windows: ~ build :android:"
5373
command: bash -c .shared-ci/scripts/build-worker.sh
54-
<<: *common
74+
<<: *windows
5575
artifact_paths:
5676
- logs/**/*
5777
env:
@@ -74,7 +94,7 @@ steps:
7494

7595
- label: ":windows: ~ build UnityClient mono"
7696
command: bash -c .shared-ci/scripts/build-worker.sh
77-
<<: *common
97+
<<: *windows
7898
artifact_paths:
7999
- logs/**/*
80100
env:
@@ -84,7 +104,7 @@ steps:
84104

85105
- label: ":windows: ~ build UnityClient il2cpp"
86106
command: bash -c .shared-ci/scripts/build-worker.sh
87-
<<: *common
107+
<<: *windows
88108
artifact_paths:
89109
- logs/**/*
90110
env:
@@ -94,7 +114,7 @@ steps:
94114

95115
- label: ":windows: ~ build UnityGameLogic mono"
96116
command: bash -c .shared-ci/scripts/build-worker.sh
97-
<<: *common
117+
<<: *windows
98118
artifact_paths:
99119
- logs/**/*
100120
env:

.editorconfig

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Matches multiple files with brace expansion notation
7+
# Set default charset
8+
[*]
9+
charset = utf-8
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
indent_style = space
13+
max_line_length = 120
14+
15+
[*.cs]
16+
indent_size = 4
17+
18+
# New line preferences
19+
csharp_new_line_before_open_brace = all
20+
csharp_new_line_before_else = true
21+
csharp_new_line_before_catch = true
22+
csharp_new_line_before_finally = true
23+
csharp_new_line_before_members_in_object_initializers = true
24+
csharp_new_line_before_members_in_anonymous_types = true
25+
csharp_new_line_between_query_expression_clauses = true
26+
27+
# Indentation preferences
28+
csharp_indent_case_contents = true
29+
csharp_indent_switch_labels = true
30+
csharp_indent_labels = flush_left
31+
32+
# Space preferences
33+
csharp_space_after_cast = true
34+
csharp_space_after_keywords_in_control_flow_statements = true
35+
csharp_space_between_method_call_parameter_list_parentheses = false
36+
csharp_space_between_method_declaration_parameter_list_parentheses = false
37+
csharp_space_between_parentheses = false
38+
csharp_space_before_colon_in_inheritance_clause = true
39+
csharp_space_after_colon_in_inheritance_clause = true
40+
csharp_space_around_binary_operators = before_and_after
41+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
42+
csharp_space_between_method_call_name_and_opening_parenthesis = false
43+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
44+
45+
# Wrapping preferences
46+
csharp_preserve_single_line_statements = true
47+
csharp_preserve_single_line_blocks = true
48+
49+
[*.json]
50+
indent_size = 2
51+
52+
[core-sdk.version]
53+
insert_final_newline = false

ci/bootstrap.sh

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,7 @@ cd "$(dirname "$0")/../"
2121

2222
echo "--- Bootstrapping :boot:"
2323

24-
SHARED_CI_DIR="$(pwd)/.shared-ci"
25-
CLONE_URL="[email protected]:spatialos/gdk-for-unity-shared-ci.git"
26-
PINNED_SHARED_CI_BRANCH=$(cat ./ci/shared-ci.pinned | cut -d' ' -f 1)
27-
PINNED_SHARED_CI_VERSION=$(cat ./ci/shared-ci.pinned | cut -d' ' -f 2)
28-
29-
# Clone the HEAD of the shared CI repo into ".shared-ci"
30-
31-
if [[ -d "${SHARED_CI_DIR}" ]]; then
32-
rm -rf "${SHARED_CI_DIR}"
33-
fi
34-
35-
mkdir "${SHARED_CI_DIR}"
36-
37-
# Workaround for being unable to clone a specific commit with depth of 1.
38-
pushd "${SHARED_CI_DIR}"
39-
git init
40-
git remote add origin "${CLONE_URL}"
41-
git fetch --depth 20 origin "${PINNED_SHARED_CI_BRANCH}"
42-
git checkout "${PINNED_SHARED_CI_VERSION}"
43-
popd
24+
./ci/get-shared-ci.sh
4425

4526
# Clone the GDK for Unity repository
4627

ci/get-shared-ci.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
set -e -u -o pipefail
3+
4+
if [[ -n "${DEBUG-}" ]]; then
5+
set -x
6+
fi
7+
8+
SHARED_CI_DIR="$(pwd)/.shared-ci"
9+
CLONE_URL="[email protected]:spatialos/gdk-for-unity-shared-ci.git"
10+
PINNED_SHARED_CI_BRANCH=$(cat ./ci/shared-ci.pinned | cut -d' ' -f 1)
11+
PINNED_SHARED_CI_VERSION=$(cat ./ci/shared-ci.pinned | cut -d' ' -f 2)
12+
13+
if [[ -d "${SHARED_CI_DIR}" ]]; then
14+
rm -rf "${SHARED_CI_DIR}"
15+
fi
16+
17+
mkdir "${SHARED_CI_DIR}"
18+
19+
# Clone the HEAD of the shared CI repo into ".shared-ci"
20+
# Workaround for being unable to clone a specific commit with depth of 1.
21+
pushd "${SHARED_CI_DIR}"
22+
git init
23+
git remote add origin "${CLONE_URL}"
24+
git fetch --depth 20 origin "${PINNED_SHARED_CI_BRANCH}"
25+
git checkout "${PINNED_SHARED_CI_VERSION}"
26+
popd

ci/lint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -u -o pipefail
4+
5+
if [[ -n "${DEBUG-}" ]]; then
6+
set -x
7+
fi
8+
9+
cd "$(dirname "$0")/.."
10+
11+
./ci/get-shared-ci.sh
12+
./.shared-ci/scripts/lint.sh ./workers/unity --check

ci/shared-ci.pinned

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
master a6c1fcd9562bf40160214acddc7e1a732a66faf4
1+
master 7980ef5db74d8db47c0f683378a38d64accd2c0a

workers/unity/Assets/BlankProject/Scripts/Workers/UnityClientConnector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using Improbable.Gdk.Core;
33
using Improbable.Gdk.PlayerLifecycle;
44
using UnityEngine;

workers/unity/Assets/BlankProject/Scripts/Workers/UnityGameLogicConnector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using BlankProject.Scripts.Config;
1+
using BlankProject.Scripts.Config;
22
using Improbable.Gdk.Core;
33
using Improbable.Gdk.PlayerLifecycle;
44
using Improbable.Worker.CInterop;

0 commit comments

Comments
 (0)