.gitlab-ci.yml 3.88 KB
Newer Older
1
image: gableroux/unity3d:2019.3.7f1
2 3

stages:
Gabriel Le Breton's avatar
Gabriel Le Breton committed
4
  - build_and_test
5
  - deploy
6

7
# If you are looking for a place where to add 'UNITY_LICENSE_FILE' and other secrets, please visit your project's gitlab page:
8
# settings > CI/CD > Variables instead
9 10
variables:
  BUILD_NAME: ExampleProjectName
11
  UNITY_ACTIVATION_FILE: ./unity3d.alf
Gabriel Le Breton's avatar
Gabriel Le Breton committed
12 13 14 15 16 17 18 19 20 21

.unity_before_script: &unity_before_script
  before_script:
    - chmod +x ./ci/before_script.sh && ./ci/before_script.sh

.cache: &cache
  cache:
    key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG-$TEST_PLATFORM"
    paths:
      - Library/
22

23 24 25
# run this job when you need to request a license
# you may need to follow activation steps from documentation
get-activation-file:
26
  when: manual
27 28
  stage: build_and_test
  script:
29
    - chmod +x ./ci/get_activation_file.sh && ./ci/get_activation_file.sh
30
  artifacts:
31
    paths:
32
      - $UNITY_ACTIVATION_FILE
33
    expire_in: 10 min # Expiring this as artifacts may contain sensitive data and should not be kept public
Gabriel Le Breton's avatar
Gabriel Le Breton committed
34 35 36 37 38 39 40 41 42 43

.test: &test
  stage: build_and_test
  <<: *unity_before_script
  <<: *cache
  script:
    - chmod +x ./ci/test.sh && ./ci/test.sh
  artifacts:
    paths:
      - $(pwd)/$TEST_PLATFORM-results.xml
44
      - $(pwd)/$TEST_PLATFORM-coverage/
45 46 47 48
  # https://gitlab.com/gableroux/unity3d-gitlab-ci-example/-/issues/83
  # you may need to remove or replace these to fit your need if you are using your own runners
  tags:
    - gitlab-org
49
  coverage: /<Linecoverage>(.*?)</Linecoverage>/
Gabriel Le Breton's avatar
Gabriel Le Breton committed
50

51
test-playmode:
Gabriel Le Breton's avatar
Gabriel Le Breton committed
52 53 54 55
  <<: *test
  variables:
    TEST_PLATFORM: playmode

56 57 58 59 60
test-editmode:
  <<: *test
  variables:
    TEST_PLATFORM: editmode

Gabriel Le Breton's avatar
Gabriel Le Breton committed
61 62 63 64 65 66 67 68 69
.build: &build
  stage: build_and_test
  <<: *unity_before_script
  <<: *cache
  script:
    - chmod +x ./ci/build.sh && ./ci/build.sh
  artifacts:
    paths:
      - ./Builds/
70 71 72 73
  # https://gitlab.com/gableroux/unity3d-gitlab-ci-example/-/issues/83
  # you may need to remove or replace these to fit your need if you are using your own runners
  tags:
    - gitlab-org
Gabriel Le Breton's avatar
Gabriel Le Breton committed
74 75 76 77 78 79

build-StandaloneLinux64:
  <<: *build
  variables:
    BUILD_TARGET: StandaloneLinux64

80 81
build-StandaloneLinux64-il2cpp:
  <<: *build
82
  image: gableroux/unity3d:2019.3.7f1-linux-il2cpp
83 84
  variables:
    BUILD_TARGET: StandaloneLinux64
85
    SCRIPTING_BACKEND: IL2CPP
86 87
    # https://forum.unity.com/threads/linux-il2cpp-linux-sysroot-not-specified-or-does-not-exist.854008/
    IL2CPP_ADDITIONAL_ARGS: "--sysroot-path=/ --tool-chain-path=/"
88

Gabriel Le Breton's avatar
Gabriel Le Breton committed
89 90
build-StandaloneOSX:
  <<: *build
91
  image: gableroux/unity3d:2019.3.7f1-mac
Gabriel Le Breton's avatar
Gabriel Le Breton committed
92 93 94 95 96 97 98 99 100 101 102
  variables:
    BUILD_TARGET: StandaloneOSX

#Note: build target names changed in recent versions, use this for versions < 2017.2:
# build-StandaloneOSXUniversal:
#   <<: *build
#   variables:
#     BUILD_TARGET: StandaloneOSXUniversal

build-StandaloneWindows64:
  <<: *build
103
  image: gableroux/unity3d:2019.3.7f1-windows
Gabriel Le Breton's avatar
Gabriel Le Breton committed
104 105 106 107 108
  variables:
    BUILD_TARGET: StandaloneWindows64

build-WebGL:
  <<: *build
109
  image: gableroux/unity3d:2019.3.7f1-webgl
Gabriel Le Breton's avatar
Gabriel Le Breton committed
110 111 112 113 114
  variables:
    BUILD_TARGET: WebGL

build-android:
  <<: *build
115
  image: gableroux/unity3d:2019.3.7f1-android
Gabriel Le Breton's avatar
Gabriel Le Breton committed
116 117
  variables:
    BUILD_TARGET: Android
118 119
    BUNDLE_VERSION_CODE: $CI_PIPELINE_IID
    BUILD_APP_BUNDLE: "false"
Gabriel Le Breton's avatar
Gabriel Le Breton committed
120

121 122
#deploy-android:
#  stage: deploy
123
#  image: ruby
124 125
#  script: 
#    - cd ./Builds/Android
126
#    - echo $GPC_TOKEN > gpc_token.json
127 128
#    - gem install bundler
#    - bundle install
129
#    - fastlane supply --aab $BUILD_NAME.aab --track internal --package_name com.youcompany.yourgame --json_key ./gpc_token.json
130
#  needs: ["build-android"]
Gabriel Le Breton's avatar
Gabriel Le Breton committed
131

132 133
build-ios-xcode:
  <<: *build
134
  image: gableroux/unity3d:2019.3.7f1-ios
135 136 137
  variables:
    BUILD_TARGET: iOS

138 139 140 141 142 143 144 145 146 147
#build-and-deploy-ios:
#  stage: deploy
#  script:
#    - cd ./Builds/iOS/$BUILD_NAME
#    - pod install
#    - fastlane ios beta
#  tags:
#    - ios
#    - mac
#  needs: ["build-ios-xcode"]
148

Gabriel Le Breton's avatar
Gabriel Le Breton committed
149 150 151 152 153 154 155 156 157 158 159
pages:
  image: alpine:latest
  stage: deploy
  script:
    - mv "./Builds/WebGL/${BUILD_NAME}" public
  artifacts:
    paths:
      - public
  only:
    - master