borepin/.gitlab-ci.yml
2021-09-25 22:50:43 +02:00

205 lines
6.2 KiB
YAML

# 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:
GIT_SUBMODULE_STRATEGY: recursive
LIB_RELEASE_FOLDER: 'Borepin\Borepin\bin\Release'
UWP_RELEASE_FOLDER: 'Borepin\Borepin.UWP\bin\x86\Release'
ANDROID_RELEASE_FOLDER: 'Borepin/Borepin.Android/bin/Release/'
IOS_RELEASE_FOLDER: 'Borepin/Borepin.iOS/bin/iPhone/Debug/'
GTK_RELEASE_FOLDER: 'Borepin/Borepin.GTK/bin/Debug/'
NUGET_PATH: 'C:\ProgramData\chocolatey\bin\nuget.exe'
DOTNET_PATH: 'C:\Program Files\dotnet\dotnet.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe'
NUNIT_PATH: 'C:\ProgramData\chocolatey\bin\nunit3-console.exe'
JARSIGNER_PATH: 'C:\ProgramData\'
stages:
- build
- test
- sign
- deploy
build_base:
stage: build
tags:
- xamarin
- windows
script:
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
- '& "$env:MSBUILD_PATH" /p:Configuration=Release /target:Restore /target:Borepin'
artifacts:
expire_in: 1 week
paths:
- '$env:LIB_RELEASE_FOLDER'
build_UWP:
needs:
- build_base
stage: build
tags:
- xamarin
- windows
script:
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
- '& "$env:MSBUILD_PATH" /p:Configuration=Debug /target:Borepin_UWP'
artifacts:
expire_in: 1 week
paths:
- '$env:UWP_RELEASE_FOLDER'
build_Android:
needs:
- build_base
stage: build
tags:
- xamarin
- windows
script:
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
- '& "$env:MSBUILD_PATH" /p:Configuration=Release /target:Borepin_Android:PackageForAndroid /p:AndroidKeyStore="False"'
artifacts:
expire_in: 1 week
paths:
- '$env:ANDROID_RELEASE_FOLDER'
build_iOS:
needs:
- build_base
stage: build
tags:
- macos
script:
- 'nuget restore' # restore Nuget dependencies
- 'msbuild /t:Restore'
- 'msbuild /t:Borepin_iOS /p:Configuration=Debug /p:Platform=iPhone /p:ArchiveOnBuild=true /p:BuildIpa=true'
artifacts:
expire_in: 1 week
paths:
- '$env:IOS_RELEASE_FOLDER'
build_GTK:
needs:
- build_base
stage: build
image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
tags:
- docker
script:
- 'nuget restore' # restore Nuget dependencies
- 'msbuild -t:Borepin_GTK'
artifacts:
expire_in: 1 week
paths:
- '$env:GTK_RELEASE_FOLDER'
#sign_Android_internal:
# only:
# - alpha
# - beta
# variables:
# - $CI_COMMIT_REF_PROTECTED
# needs:
# - build_Android
# stage: sign
# tags:
# - xamarin
# - windows
# script:
# - '[System.IO.File]::WriteAllBytes("$(pwd)/fabaccess.keystore", [System.Convert]::FromBase64String($AndroidKeyStore))'
# - '& "$env:JARSIGNER_PATH" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore "$(pwd)/fabaccess.keystore" Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess.aab "$AndroidKeyStore_ID_Internal" -storepass "$AndroidKeyStore_Password_Internal" -keypass "$AndroidKeyStore_Password_Internal"'
# - rm "$(pwd)/fabaccess.keystore"
# artifacts:
# expire_in: 1 week
# paths:
# - '$env:ANDROID_RELEASE_FOLDER'
#deploy_Android_alpha:
# variables:
# LC_ALL: 'en_US.UTF-8'
# LANG: 'en_US.UTF-8'
# only:
# - alpha
# needs:
# - build_Android
# stage: deploy
# image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
# tags:
# - docker
# 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'
# after_script:
# - 'rm play-store-credentials.json'
# dependencies:
# - build_Android
#deploy_Android_beta:
# variables:
# LC_ALL: 'en_US.UTF-8'
# LANG: 'en_US.UTF-8'
# only:
# - beta
# needs:
# - build_Android
# stage: deploy
# image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
# tags:
# - docker
# 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 beta'
# after_script:
# - 'rm play-store-credentials.json'
# dependencies:
# - build_Android
#deploy_iOS:
# variables:
# LC_ALL: 'en_US.UTF-8'
# LANG: 'en_US.UTF-8'
# only:
# - alpha
# - feature/fastlane
# needs:
# - build_iOS
# stage: deploy
# tags:
# - macos
# before_script:
# - 'echo $app_store_credentials > app-store-credentials.json'
# - 'export PATH="/usr/local/opt/ruby/bin:$PATH"'
# script:
# - 'bundle install'
# - 'bundle exec fastlane pilot upload --api_key_path app-store-credentials.json --ipa Borepin/Borepin.iOS/bin/iPhone/Debug/Borepin.iOS.ipa'
# after_script:
# - 'rm app-store-credentials.json'
# dependencies:
# - build_iOS