-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy path.gitlab-ci.yml
159 lines (141 loc) · 6.6 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
stages:
- build
- upload
- release
variables:
ARTIFACT_LINUX: "cgenius-linux-${CI_COMMIT_SHORT_SHA}"
ARTIFACT_WIN_EXE: "cgenius-winexe-${CI_COMMIT_SHORT_SHA}"
ARTIFACT_WIN_ZIP: "cgenius-winzip-${CI_COMMIT_SHORT_SHA}"
ARTIFACT_MACOS: "cgenius-macos-${CI_COMMIT_SHORT_SHA}"
ARTIFACT_LINUX_FILE: "cgenius-linux-${CI_COMMIT_SHORT_SHA}.tar.gz"
ARTIFACT_WIN_EXE_FILE: "cgenius-winexe-${CI_COMMIT_SHORT_SHA}.exe"
ARTIFACT_WIN_ZIP_FILE: "cgenius-winzip-${CI_COMMIT_SHORT_SHA}.zip"
ARTIFACT_MACOS_FILE: "cgenius-macos-${CI_COMMIT_SHORT_SHA}.dmg"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/cgenius/daily"
build:windows-portable:
image: cgenius/crossbuild:win
stage: build
before_script:
- cd $CI_PROJECT_DIR && git clone https://gitlab.com/Dringgstein/cosmos.git src/engine/cosmos
- mkdir -p /tmp && cd "$_"
- mkdir -p $CI_PROJECT_DIR/output
- cmake -DCMAKE_TOOLCHAIN_FILE="$OLDPWD/toolchains/toolchain-mingw.cmake" -DCMAKE_BUILD_TYPE=Release -DBUILD_COSMOS=1 -DUSE_BOOST=0 -DPULL_DLLS=1 -DAPPEND_SHA=1 -DSDL2_MIXER_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include/SDL2 -DSDL2_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include/SDL2 "$CI_PROJECT_DIR"
script:
- cmake --build .
- cpack -G ZIP
- cp *.zip $CI_PROJECT_DIR/output
artifacts:
name: "CGenius-Win-$CI_COMMIT_SHORT_SHA"
expire_in: 1 week
paths:
- output/*
upload:windows-portable:
stage: upload
image: curlimages/curl:latest
only:
- tags
script:
- "curl --header \"JOB-TOKEN: ${CI_JOB_TOKEN}\" --upload-file \"`ls -1 output/* | grep Release-win32.zip`\" \"${PACKAGE_REGISTRY_URL}/${ARTIFACT_WIN_ZIP_FILE}\""
dependencies:
- build:windows-portable
build:windows-installer:
image: cgenius/crossbuild:winnsis
stage: build
before_script:
- cd $CI_PROJECT_DIR && git clone https://gitlab.com/Dringgstein/cosmos.git src/engine/cosmos
- mkdir -p /tmp && cd "$_"
- mkdir -p $CI_PROJECT_DIR/output
- cmake -DCMAKE_TOOLCHAIN_FILE="$OLDPWD/toolchains/toolchain-mingw.cmake" -DCMAKE_BUILD_TYPE=Release -DBUILD_COSMOS=1 -DUSE_BOOST=0 -DPULL_DLLS=1 -DAPPEND_SHA=1 -DSDL2_MIXER_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include/SDL2 -DSDL2_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include/SDL2 "$CI_PROJECT_DIR"
script:
- cmake --build .
- cpack -G NSIS
- cp *.exe $CI_PROJECT_DIR/output
artifacts:
name: "CGenius-Win-$CI_COMMIT_SHORT_SHA"
expire_in: 1 week
paths:
- output/*
upload:windows-installer:
stage: upload
image: curlimages/curl:latest
only:
- tags
script:
- "curl --header \"JOB-TOKEN: ${CI_JOB_TOKEN}\" --upload-file \"`ls -1 output/* | grep Release-win32.exe`\" \"${PACKAGE_REGISTRY_URL}/${ARTIFACT_WIN_EXE_FILE}\""
dependencies:
- build:windows-installer
build:linux-generic:
image: cgenius/crossbuild:linux
stage: build
before_script:
- cd $CI_PROJECT_DIR && git clone https://gitlab.com/Dringgstein/cosmos.git src/engine/cosmos
- mkdir -p /tmp && cd "$_"
- mkdir -p $CI_PROJECT_DIR/output
- cmake -DUSE_BOOST=0 -DBUILD_COSMOS=1 -DAPPEND_SHA=1 $CI_PROJECT_DIR "$CI_PROJECT_DIR"
script:
- cmake --build .
- cpack -G TGZ
- cp *.tar.gz $CI_PROJECT_DIR/output
artifacts:
name: "$ARTIFACT_LINUX"
expire_in: 1 week
paths:
- output/*
upload:linux-generic:
stage: upload
image: curlimages/curl:latest
only:
- tags
script:
- "echo \"curl --header \"JOB-TOKEN: ${CI_JOB_TOKEN}\" --upload-file \"`ls -1 output/* | grep Release-generic.tar.gz`\" \"${PACKAGE_REGISTRY_URL}/${ARTIFACT_LINUX_FILE}\"\""
- "curl --header \"JOB-TOKEN: ${CI_JOB_TOKEN}\" --upload-file \"`ls -1 output/* | grep Release-generic.tar.gz`\" \"${PACKAGE_REGISTRY_URL}/${ARTIFACT_LINUX_FILE}\""
dependencies:
- build:linux-generic
build:macos-64bit:
image: cgenius/crossbuild:mac
stage: build
before_script:
- cd $CI_PROJECT_DIR && git clone https://gitlab.com/Dringgstein/cosmos.git src/engine/cosmos
- mkdir -p /tmp && cd "$_"
- mkdir -p $CI_PROJECT_DIR/output
- mkdir CGBuildMac
- cd CGBuildMac
- export PATH=$PATH:/tmp/osxcross/target/bin
- export CG_SOURCES=${CI_PROJECT_DIR}
- export OSXCROSSPATH=/tmp/osxcross
- export OSXOPT=${OSXCROSSPATH}/target/macports/pkgs/opt
- export SDKROOT=${OSXOPT}/local
- export MACOSX_DEPLOYMENT_TARGET=12.0
- x86_64-apple-darwin21.4-cmake -DCMAKE_TOOLCHAIN_FILE=${CG_SOURCES}/toolchains/toolchain-osxcross.cmake -DSDL2_LIBRARY=${SDKROOT}/lib/libSDL2.dylib -DSDL2_IMAGE_LIBRARY=${SDKROOT}/lib/libSDL2_image.dylib -DSDL2_MIXER_LIBRARY=${SDKROOT}/lib/libSDL2_mixer.dylib -DSDL2_TTF_LIBRARY=${SDKROOT}/lib/libSDL2_ttf.dylib -DCURL_LIBRARY=${SDKROOT}/lib/libcurl.dylib -DCMAKE_SHARED_LIBRARY_SUFFIX=".dylib" -DCMAKE_SYSTEM_PREFIX_PATH=${SDKROOT} -DAPPEND_SHA=1 -DCMAKE_BUILD_TYPE="Release" -DOSXCROSS=1 -DUSE_OPENGL=0 -DUSE_BOOST=0 ${CG_SOURCES}
script:
- cmake --build .
- cp src/CGeniusExe ${CI_PROJECT_DIR}/src
- cd $CI_PROJECT_DIR
- bash buildMacOsBundle.sh
- cp *.dmg $CI_PROJECT_DIR/output
artifacts:
name: "$ARTIFACT_MACOS"
expire_in: 1 week
paths:
- output/*
upload:macos-64bit:
stage: upload
image: curlimages/curl:latest
only:
- tags
script:
- "curl --header \"JOB-TOKEN: ${CI_JOB_TOKEN}\" --upload-file \"`ls -1 output/* | grep Release-MacOS.dmg`\" \"${PACKAGE_REGISTRY_URL}/${ARTIFACT_MACOS_FILE}\""
dependencies:
- build:macos-64bit
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
- tags
script:
- "echo \"Linux-generic url: ${PACKAGE_REGISTRY_URL}/${ARTIFACT_LINUX_FILE}\""
- release-cli create --name "Release $CI_COMMIT_TAG" --tag-name "$CI_COMMIT_TAG"
--assets-link "{\"name\":\"${ARTIFACT_LINUX}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${ARTIFACT_LINUX_FILE}\"}"
--assets-link "{\"name\":\"${ARTIFACT_WIN_EXE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${ARTIFACT_WIN_EXE_FILE}\"}"
--assets-link "{\"name\":\"${ARTIFACT_WIN_ZIP}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${ARTIFACT_WIN_ZIP_FILE}\"}"
--assets-link "{\"name\":\"${ARTIFACT_MACOS}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${ARTIFACT_MACOS_FILE}\"}"