2020-09-17 10:50:56 +00:00
|
|
|
# This file is a template, and might need editing before it works on your project.
|
|
|
|
# The following script will work for any project that can be built from command line by msbuild
|
|
|
|
# It uses powershell shell executor, so you need to add the following line to your config.toml file
|
|
|
|
# (located in gitlab-runner.exe directory):
|
|
|
|
# shell = "powershell"
|
|
|
|
#
|
|
|
|
# The script is composed of 3 stages: build, test and deploy.
|
|
|
|
#
|
|
|
|
# The build stage restores NuGet packages and uses msbuild to build the exe and msi
|
|
|
|
# One major issue you'll find is that you can't build msi projects from command line
|
|
|
|
# if you use vdproj. There are workarounds building msi via devenv, but they rarely work
|
|
|
|
# The best solution is migrating your vdproj projects to WiX, as it can be build directly
|
|
|
|
# by msbuild.
|
|
|
|
#
|
|
|
|
# The test stage runs nunit from command line against Test project inside your solution
|
|
|
|
# It also saves the resulting TestResult.xml file
|
|
|
|
#
|
|
|
|
# The deploy stage copies the exe and msi from build stage to a network drive
|
|
|
|
# You need to have the network drive mapped as Local System user for gitlab-runner service to see it
|
|
|
|
# The best way to persist the mapping is via a scheduled task (see: https://stackoverflow.com/a/7867064/1288473),
|
|
|
|
# running the following batch command: net use P: \\x.x.x.x\Projects /u:your_user your_pass /persistent:yes
|
|
|
|
|
|
|
|
|
|
|
|
# place project specific paths in variables to make the rest of the script more generic
|
|
|
|
variables:
|
2021-01-29 17:41:16 +00:00
|
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
2020-09-17 15:45:25 +00:00
|
|
|
LIB_RELEASE_FOLDER: 'Borepin\Borepin\bin\Release'
|
|
|
|
UWP_RELEASE_FOLDER: 'Borepin\Borepin.UWP\bin\x86\Release'
|
2020-09-17 10:50:56 +00:00
|
|
|
TEST_FOLDER: 'Tests\bin\Release'
|
|
|
|
# DEPLOY_FOLDER: 'P:\Projects\YourApp\Builds'
|
2021-09-08 02:16:55 +02:00
|
|
|
NUGET_PATH: 'C:\ProgramData\chocolatey\bin\nuget.exe'
|
2020-09-17 12:19:50 +00:00
|
|
|
DOTNET_PATH: 'C:\Program Files\dotnet\dotnet.exe'
|
2021-09-08 02:21:19 +02:00
|
|
|
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe'
|
2021-09-08 02:16:55 +02:00
|
|
|
NUNIT_PATH: 'C:\ProgramData\chocolatey\bin\nunit3-console.exe'
|
2020-09-17 10:50:56 +00:00
|
|
|
|
2021-09-07 15:38:12 +02:00
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- deploy
|
2020-09-17 10:50:56 +00:00
|
|
|
|
2021-09-07 15:38:12 +02:00
|
|
|
build_base:
|
|
|
|
stage: build
|
|
|
|
tags:
|
|
|
|
- xamarin
|
|
|
|
- windows
|
2020-09-17 10:50:56 +00:00
|
|
|
# only:
|
|
|
|
# - tags # the build process will only be started by git tag commits
|
2021-09-07 15:38:12 +02:00
|
|
|
script:
|
|
|
|
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
|
|
|
|
- '& "$env:MSBUILD_PATH" /p:Configuration=Release /target:Borepin' # build the project
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
|
|
|
|
paths:
|
|
|
|
- '$env:LIB_RELEASE_FOLDER' # saving exe to copy to deploy folder
|
2021-01-31 20:53:53 +00:00
|
|
|
# - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
|
2020-09-17 10:50:56 +00:00
|
|
|
|
2021-09-13 23:16:12 +00:00
|
|
|
build_UWP:
|
2021-09-13 21:29:13 +00:00
|
|
|
needs:
|
|
|
|
- build_base
|
2021-09-07 15:38:12 +02:00
|
|
|
stage: build
|
|
|
|
tags:
|
|
|
|
- xamarin
|
|
|
|
- windows
|
2020-09-17 14:13:05 +00:00
|
|
|
# only:
|
|
|
|
# - tags # the build process will only be started by git tag commits
|
2021-09-07 15:38:12 +02:00
|
|
|
script:
|
|
|
|
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
|
|
|
|
- '& "$env:MSBUILD_PATH" /p:Configuration=Debug /target:Borepin_UWP' # build the project
|
2021-01-31 15:52:47 +01:00
|
|
|
# artifacts:
|
|
|
|
# expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
|
|
|
|
# paths:
|
|
|
|
# - '$env:UWP_RELEASE_FOLDER' # saving exe to copy to deploy folder
|
|
|
|
# - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
|
2020-09-17 14:13:05 +00:00
|
|
|
|
2021-09-07 15:38:12 +02:00
|
|
|
build_Android:
|
2021-09-13 21:29:13 +00:00
|
|
|
needs:
|
|
|
|
- build_base
|
2021-09-07 15:38:12 +02:00
|
|
|
stage: build
|
|
|
|
tags:
|
|
|
|
- xamarin
|
|
|
|
- windows
|
2020-09-17 14:42:11 +00:00
|
|
|
# only:
|
|
|
|
# - tags # the build process will only be started by git tag commits
|
2021-09-07 15:38:12 +02:00
|
|
|
script:
|
|
|
|
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
|
2021-09-14 00:05:48 +00:00
|
|
|
- '[System.IO.File]::WriteAllBytes("$(pwd)/fabaccess.keystore", [System.Convert]::FromBase64String($AndroidKeyStore))'
|
2021-09-13 23:21:17 +00:00
|
|
|
- '& "$env:MSBUILD_PATH" /p:Configuration=Release /target:Borepin_Android:PackageForAndroid /target:Borepin_Android:SignAndroidPackage /p:AndroidKeyStore="True" /p:AndroidSigningKeyStore="$(pwd)/fabaccess.keystore" /p:AndroidSigningKeyPass="$AndroidKeyStore_Password" /p:AndroidSigningKeyAlias="$AndroidKeyStore_ID" /p:AndroidSigningStorePass="$AndroidKeyStore_Password"' # build the project
|
2021-09-13 23:15:03 +00:00
|
|
|
- rm "$(pwd)/fabaccess.keystore"
|
2021-09-07 15:38:12 +02:00
|
|
|
artifacts:
|
|
|
|
expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
|
|
|
|
paths:
|
2021-09-17 01:18:13 +02:00
|
|
|
- Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.aab # saving apk to copy to deploy folder
|
2021-09-13 23:06:09 +00:00
|
|
|
- Borepin/Borepin.Android/bin/Release/
|
2021-01-31 20:53:53 +00:00
|
|
|
# - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
|
2020-09-17 14:42:11 +00:00
|
|
|
|
2021-09-07 15:38:12 +02:00
|
|
|
build_iOS:
|
2021-09-13 21:29:13 +00:00
|
|
|
needs:
|
|
|
|
- build_base
|
|
|
|
stage: build
|
|
|
|
tags:
|
|
|
|
- macos
|
|
|
|
# only:
|
|
|
|
# - tags # the build process will only be started by git tag commits
|
|
|
|
script:
|
|
|
|
- 'nuget restore' # restore Nuget dependencies
|
|
|
|
- 'msbuild /t:Borepin_iOS /p:Configuration=Debug /p:Platform=iPhone /p:ArchiveOnBuild=true' # build the project /p:AndroidKeyStore=True
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
|
|
|
|
paths:
|
|
|
|
- Borepin/Borepin.iOS/bin/iPhone/Debug/Borepin.ipa
|
|
|
|
- Borepin/Borepin.iOS/bin/iPhone/Debug/Borepin.app.dSYM
|
|
|
|
# - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
|
2020-09-17 15:41:21 +00:00
|
|
|
|
2021-09-07 15:38:12 +02:00
|
|
|
build_GTK:
|
2021-09-13 21:29:13 +00:00
|
|
|
needs:
|
|
|
|
- build_base
|
2021-09-07 15:38:12 +02:00
|
|
|
stage: build
|
|
|
|
image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
|
|
|
|
tags:
|
|
|
|
- docker
|
2021-01-05 17:55:54 +00:00
|
|
|
# only:
|
|
|
|
# - tags # the build process will only be started by git tag commits
|
2021-09-07 15:38:12 +02:00
|
|
|
script:
|
|
|
|
- 'nuget restore' # restore Nuget dependencies
|
|
|
|
- 'msbuild -t:Borepin_GTK' # build the project /p:AndroidKeyStore=True
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
|
|
|
|
paths:
|
|
|
|
- Borepin/Borepin.GTK/bin/Debug/
|
2021-01-05 17:55:54 +00:00
|
|
|
|
2020-09-17 14:13:39 +00:00
|
|
|
# test_job:
|
|
|
|
# stage: test
|
|
|
|
# tags:
|
|
|
|
# - xamarin
|
|
|
|
# - windows
|
|
|
|
# # only:
|
|
|
|
# # - tags
|
|
|
|
# script:
|
|
|
|
# - '& "$env:NUNIT_PATH" ".\$env:TEST_FOLDER\Tests.dll"' # running NUnit tests
|
|
|
|
# artifacts:
|
|
|
|
# when: always # save test results even when the task fails
|
|
|
|
# expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
|
|
|
|
# paths:
|
|
|
|
# - '.\TestResult.xml' # saving NUnit results to copy to deploy folder
|
|
|
|
# dependencies:
|
|
|
|
# - build_job
|
2020-09-17 10:50:56 +00:00
|
|
|
|
2021-09-16 23:24:16 +00:00
|
|
|
deploy_Android:
|
2021-09-16 23:22:24 +00:00
|
|
|
needs:
|
2021-09-16 23:24:16 +00:00
|
|
|
- build_Android
|
2021-09-17 01:09:51 +02:00
|
|
|
stage: deploy
|
|
|
|
image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
|
2021-09-16 23:21:09 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
2021-09-17 01:09:51 +02:00
|
|
|
before_script:
|
|
|
|
- 'echo $play_store_credentials > play-store-credentials.json'
|
|
|
|
script:
|
|
|
|
- 'bundle install'
|
|
|
|
- 'bundle exec fastlane supply --aab Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.aab --track internal'
|
2021-09-16 23:54:10 +00:00
|
|
|
after_script:
|
|
|
|
- 'rm play-store-credentials.json'
|
2021-09-17 01:09:51 +02:00
|
|
|
dependencies:
|
|
|
|
- build_Android
|