Common GitLab Configurations
Rules
Rules are used to control when your jobs run. We provide several common rules:
include:
- https://ci.andtechstudios.com/rules.yml
My Job:
rules:
# Push to default branch
- !reference [.push/main, rules]
# Push to default branch (manual trigger)
- !reference [.push/main.manual, rules]
# Push semver tag
- !reference [.push/semver, rules]
# Push semver tag (manual trigger)
- !reference [.push/semver.manual, rules]
# Push merge request into default branch
- !reference [.push/mr/main, rules]
Complex Tags
Because variables cannot be used with
rules:if
, you must explicitly write rules for complex tags.My Job:
rules:
- if: $CI_COMMIT_TAG =~ /^production\/v(?:\d+.){2}(?:\d+)(-.+)?/
- if: $CI_COMMIT_TAG =~ /^alpha\/v(?:\d+.){2}(?:\d+)(-.+)?/
- if: $CI_COMMIT_TAG =~ /^beta/\testflight\/v(?:\d+.){2}(?:\d+)(-.+)?/
This job will only run for the following tag pipelines:
production/v*
alpha/v*
beta/testflight/v*
GitLab Pages
include:
- https://ci.andtechstudios.com/gitlab-pages/deploy.yml
pages:
extends: .gitlab-pages/deploy
Unity
In general, Unity jobs require several command line tools:
- Unity
- Gooball
- Raccoon
- ReportGenerator CLI
- Fastlane
- Xcode
- MinIO Client
Install the required tools on your server. Then, register the machine as a GitLab Runner (shell executor).
Build
Build from Default Branch
- Build the project and upload as a job artifact.
include:
- https://ci.andtechstudios.com/unity/build.yml
Build App:
extends: .workflows/unity/build.html
#extends: .workflows/unity/build.linux
#extends: .workflows/unity/build.macos
#extends: .workflows/unity/build.windows
Test
Run Tests (Standard)
- Provides continuous unit tests reports for the following:
- Default branch pipelines
- Merge request pipelines (where the default branch is the target)
- Test results are displayed in a merge request widget.
include:
- https://ci.andtechstudios.com/workflows/unity/test.yml
Run Tests:
extends: .workflows/unity/test
Code Quality
Lint (Standard)
- Provides continuous code quality reports for the following:
- Default branch pipelines
- Merge request pipelines (where the default branch is the target)
- Code quality findings are displayed in a merge request widget.
- An HTML code quality report is exposed in a merge request widget.
include:
- https://ci.andtechstudios.com/workflows/unity/enforcer/lint.yml
Code Quality:
extends: .workflows/unity/enforcer/lint
Code Quality (HTML):
extends: .workflows/unity/enforcer/lint.html
itch.io
Deploy App
include:
- https://ci.andtechstudios.com/workflows/unity/itch.io/deploy.yml
Deploy App:
extends: .workflows/unity/itch.io/deploy.html
#extends: .workflows/unity/itch.io/deploy.linux
#extends: .workflows/unity/itch.io/deploy.macos
#extends: .workflows/unity/itch.io/deploy.windows
S3
Deploy from Default Branch
Windows
include:
- https://ci.andtechstudios.com/workflows/unity/s3/default-branch/windows/deploy.yml
Deploy Review App:
extends: .workflows/unity/s3/default-branch/windows/deploy
Android
include:
- https://ci.andtechstudios.com/workflows/unity/s3/default-branch/android/deploy.yml
Deploy Review App:
extends: .workflows/unity/s3/default-branch/android/deploy
iOS
include:
- https://ci.andtechstudios.com/workflows/unity/fastlane/s3/default-branch/ios/deploy.yml
Deploy Review App:
extends: .workflows/unity/fastlane/s3/default-branch/ios/deploy
Deploy on Merge Request
Android
include:
- https://ci.andtechstudios.com/workflows/unity/s3/default-branch/merge-request/android/deploy.yml
Deploy Review App:
extends: .workflows/unity/s3/default-branch/merge-request/android/deploy
iOS
include:
- https://ci.andtechstudios.com/workflows/unity/fastlane/s3/default-branch/merge-request/ios/deploy.yml
Deploy Review App:
extends: .workflows/unity/fastlane/s3/default-branch/merge-request/ios/deploy
TestFlight
Deploy from Default Branch
include:
- https://ci.andtechstudios.com/workflows/unity/fastlane/testflight/default-branch/deploy.yml
Deploy TestFlight:
extends: .workflows/unity/fastlane/testflight/default-branch/deploy
# variables:
# APP_STORE_CONNECT_USES_NON_EXEMPT_ENCRYPTION: "true"
# APP_STORE_CONNECT_DISTRIBUTE_EXTERNAL: "true"
# APP_STORE_CONNECT_GROUPS: "Beta"
UPM
Deploy on Tag Push
include:
- https://ci.andtechstudios.com/workflows/unity/upm/deploy.yml
variables:
NODE_PROJECT_DIR: $CI_PROJECT_DIR/unity/Assets/com.example.package
Deploy Package:
extends: .workflows/unity/upm/deploy
DocFX
Deploy from Default Branch
include:
- https://ci.andtechstudios.com/workflows/unity/docfx/pages/build.yml
pages:
extends: .workflows/unity/docfx/pages/build
GitLab Pages
Deploy from Default Branch
include:
- https://ci.andtechstudios.com/workflows/unity/gitlab/pages/default-branch/webgl/deploy.yml
pages:
extends: .workflows/unity/gitlab/pages/default-branch/webgl/deploy
Discord
Note: Create a Discord Integration before proceeding.
include:
- https://ci.andtechstudios.com/discord/notify.yml
Send Notifications:
extends: .discord/notify
stage: .post
Notify after a job completes
Example Job:
script:
- echo "Hello world..."
after_script:
- !reference [.discord/notify, script]
Use a custom message format
Send Notifications:
extends: .discord/notify
stage: .post
variables:
DISCORD_MESSAGE_FORMAT: "Pipeline #${CI_PIPELINE_IID} completed succesfully"