forked from ETCLabs/mDNSWindows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
100 lines (90 loc) · 3.3 KB
/
.gitlab-ci.yml
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
89
90
91
92
93
94
95
96
97
98
99
100
workflow:
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
stages:
- build
- build-merge-module
- deploy
variables:
GIT_STRATEGY: clone
NEW_VERSION:
value: "CHANGE-ME"
description: "The new version to deploy for a versioned build, in the form M.m.p"
PROJECT_BOT_USER: project_217_bot
include:
- project: 'etc/common-tech/tools/gitlab-ci-util'
ref: v1.1.0
file: '/ci-yml/python-utils.yml'
.windows-build:
stage: build
tags:
- ct-windows
parallel:
matrix:
- CMAKE_GENERATOR: Visual Studio 15 2017
ARTIFACT_TYPE: x86
- CMAKE_GENERATOR: Visual Studio 15 2017 Win64
ARTIFACT_TYPE: x64
script:
- mkdir build_$env:ARTIFACT_TYPE
- cd build_$env:ARTIFACT_TYPE
- cmake -G "$env:CMAKE_GENERATOR" -DCMAKE_INSTALL_PREFIX=install ..
- cmake --build . --config Release
- cmake -P cmake_install.cmake
artifacts:
paths:
- build_$ARTIFACT_TYPE/install
windows-test-build:
extends: .windows-build
rules:
- if: '$CI_PIPELINE_SOURCE != "web"'
windows-versioned-build:
extends: .windows-build
rules:
- if: '$CI_PIPELINE_SOURCE == "web" && $NEW_VERSION =~ /^\d+\.\d+\.\d+$/'
before_script:
- etclibtool version --from-ci --config tools/ci/etclibtool_config.json --step update-files . ($NEW_VERSION + ".1")
.windows-build-merge-module:
stage: build-merge-module
tags:
- ct-windows
script:
- ren build_x86 build
- >
& 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe'
-property:Configuration=Release -property:Platform=x86 .\tools\install\mDNSInstall.sln
windows-build-test-merge-module:
extends: .windows-build-merge-module
rules:
- if: '$CI_PIPELINE_SOURCE != "web"'
windows-build-versioned-merge-module:
extends: .windows-build-merge-module
rules:
- if: '$CI_PIPELINE_SOURCE == "web" && $NEW_VERSION =~ /^\d+\.\d+\.\d+$/'
before_script:
- etclibtool version --from-ci --config tools/ci/etclibtool_config.json --step update-files . ($NEW_VERSION + ".1")
artifacts:
paths:
- tools/install/bin/Release/ETC_mDNSInstall.msm
# Deploy to GitHub Release for any new 3-digit version (M.m.p)
deploy-binaries:
stage: deploy
tags:
- ct-linux-docker
image: etc-docker.artifactory-mid.etcconnect.com/python:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "web" && $NEW_VERSION =~ /^\d+\.\d+\.\d+$/'
script:
- pip config set global.index-url https://artifactory-mid.etcconnect.com/artifactory/api/pypi/ETC-PyPI/simple
- pip config set global.trusted-host artifactory-mid.etcconnect.com
- pip install requests etclibtool PyGithub
- git config user.name "GitLab CI"
- git config user.email "[email protected]"
- git config http.sslVerify false
- etclibtool version --from-ci --config tools/ci/etclibtool_config.json --step update-files . ${NEW_VERSION}.1
- git add .
- git commit -m "[skip ci] Update version files for mDNSWindows version ${NEW_VERSION}"
- git tag -a v${NEW_VERSION} -m "mDNSWindows release version ${NEW_VERSION}"
- git push "https://${PROJECT_BOT_USER}:${REPO_PUSH_TOKEN}@gitlab.etcconnect.com/${CI_PROJECT_PATH}.git" HEAD:${CI_COMMIT_REF_NAME} --tags
- python3 tools/ci/deploy_to_github_release.py ${NEW_VERSION}