This repository was archived by the owner on Jun 12, 2021. It is now read-only.
forked from ciribob/DCS-SimpleRadioStandalone
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
88 lines (81 loc) · 3.54 KB
/
.gitlab-ci.yml
File metadata and controls
88 lines (81 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 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
.shared_windows_runners:
tags:
- shared-windows
- windows
- windows-1809
# place project specific paths in variables to make the rest of the script more generic
variables:
RELEASE_FOLDER: 'OverlordBot\bin\Release'
TEST_FOLDER: 'Tests\bin\Release'
DEPLOY_FOLDER: 'P:\Projects\OverlordBot\Builds'
NUNIT_PATH: 'C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe'
stages:
- build
# - test
# - deploy
build_job:
extends:
- .shared_windows_runners
stage: build
only:
script:
- '$Env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"'
- '& nuget restore' # restore Nuget dependencies
- '& msbuild /p:Configuration=Release /p:Platform=x64 /p:SourceLinkCreate=false' # 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:RELEASE_FOLDER\' # saving folder
- '$env:TEST_FOLDER\' # saving entire Test project so NUnit can run tests
# test_job:
# stage: test
# 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
# deploy_job:
# stage: deploy
# only:
# - tags
# script:
# Compose a folder for each release based on commit tag.
# Assuming your tag is Rev1.0.0.1, and your last commit message is 'First commit'
# the artifact files will be copied to:
# P:\Projects\YourApp\Builds\Rev1.0.0.1 - First commit\
# - '$commitSubject = git log -1 --pretty=%s'
# - '$deployFolder = $($env:DEPLOY_FOLDER) + "\" + $($env:CI_BUILD_TAG) + " - " + $commitSubject + "\"'
# xcopy takes care of recursively creating required folders
# - 'xcopy /y ".\$env:EXE_RELEASE_FOLDER\YourApp.exe" "$deployFolder"'
# - 'xcopy /y ".\$env:MSI_RELEASE_FOLDER\YourApp Setup.msi" "$deployFolder"'
# - 'xcopy /y ".\TestResult.xml" "$deployFolder"'
# dependencies:
# - build_job
# - test_job