Restructured Build Process

This commit is contained in:
TheJoKlLa 2021-09-25 22:50:43 +02:00
parent 8c446e76cd
commit f954928a0d

View File

@ -25,16 +25,22 @@
variables:
GIT_SUBMODULE_STRATEGY: recursive
LIB_RELEASE_FOLDER: 'Borepin\Borepin\bin\Release'
UWP_RELEASE_FOLDER: 'Borepin\Borepin.UWP\bin\x86\Release'
TEST_FOLDER: 'Tests\bin\Release'
# DEPLOY_FOLDER: 'P:\Projects\YourApp\Builds'
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:
@ -42,16 +48,13 @@ build_base:
tags:
- xamarin
- windows
# only:
# - tags # the build process will only be started by git tag commits
script:
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
- '& "$env:MSBUILD_PATH" /p:Configuration=Release /target:Restore /target:Borepin' # build the project
- '& "$env:MSBUILD_PATH" /p:Configuration=Release /target:Restore /target:Borepin'
artifacts:
expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
expire_in: 1 week
paths:
- '$env:LIB_RELEASE_FOLDER' # saving exe to copy to deploy folder
# - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
- '$env:LIB_RELEASE_FOLDER'
build_UWP:
needs:
@ -60,16 +63,13 @@ build_UWP:
tags:
- xamarin
- windows
# only:
# - tags # the build process will only be started by git tag commits
script:
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
- '& "$env:MSBUILD_PATH" /p:Configuration=Debug /target:Borepin_UWP' # 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:UWP_RELEASE_FOLDER' # saving exe to copy to deploy folder
# - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
- '& "$env:MSBUILD_PATH" /p:Configuration=Debug /target:Borepin_UWP'
artifacts:
expire_in: 1 week
paths:
- '$env:UWP_RELEASE_FOLDER'
build_Android:
needs:
@ -78,19 +78,13 @@ build_Android:
tags:
- xamarin
- windows
# only:
# - tags # the build process will only be started by git tag commits
script:
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
- '[System.IO.File]::WriteAllBytes("$(pwd)/fabaccess.keystore", [System.Convert]::FromBase64String($AndroidKeyStore))'
- '& "$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
- rm "$(pwd)/fabaccess.keystore"
- '& "$env:MSBUILD_PATH" /p:Configuration=Release /target:Borepin_Android:PackageForAndroid /p:AndroidKeyStore="False"'
artifacts:
expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
expire_in: 1 week
paths:
- Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.aab # saving apk to copy to deploy folder
- Borepin/Borepin.Android/bin/Release/
# - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
- '$env:ANDROID_RELEASE_FOLDER'
build_iOS:
needs:
@ -98,18 +92,14 @@ build_iOS:
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:Restore'
- 'msbuild /t:Borepin_iOS /p:Configuration=Debug /p:Platform=iPhone /p:ArchiveOnBuild=true /p:BuildIpa=true' # build the project /p:AndroidKeyStore=True
- 'msbuild /t:Borepin_iOS /p:Configuration=Debug /p:Platform=iPhone /p:ArchiveOnBuild=true /p:BuildIpa=true'
artifacts:
expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
expire_in: 1 week
paths:
- Borepin/Borepin.iOS/bin/iPhone/Debug/Borepin.iOS.ipa
- Borepin/Borepin.iOS/bin/iPhone/Debug/
# - '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
- '$env:IOS_RELEASE_FOLDER'
build_GTK:
needs:
@ -118,96 +108,98 @@ build_GTK:
image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
tags:
- docker
# only:
# - tags # the build process will only be started by git tag commits
script:
- 'nuget restore' # restore Nuget dependencies
- 'msbuild -t:Borepin_GTK' # build the project /p:AndroidKeyStore=True
- 'msbuild -t:Borepin_GTK'
artifacts:
expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
expire_in: 1 week
paths:
- Borepin/Borepin.GTK/bin/Debug/
- '$env:GTK_RELEASE_FOLDER'
# 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
#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_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_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
#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