-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
149 lines (145 loc) · 5.93 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
149 lines (145 loc) · 5.93 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
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
stages:
- build
- test
- package
- release
build-job:
stage: build
image: ubuntu:24.04
tags:
- cmake
before_script:
- apt-get update
- apt-get clean
- apt-get install -y software-properties-common curl jq unzip wget
- apt-add-repository ppa:mutlaqja/ppa
- apt-get update
- apt-get clean
- apt-get install -y build-essential cmake git npm qtbase5-dev libqt5websockets5-dev libindi-dev libstellarsolver-dev libnova-dev libgsl-dev wcslib-dev libcfitsio-dev libavahi-client-dev libavahi-common-dev zlib1g-dev dpkg-dev debhelper devscripts libopencv-dev qtmultimedia5-dev libqt5scxml5-dev qtdeclarative5-dev
- echo "Downloading ostserver from OST project artifacts..."
- export LAST_JOB=$(curl -s "https://gitlab.ostserver.fr/api/v4/projects/1/pipelines" | jq -r '.[] | select(.status=="success") | .id' | head -1)
- echo "Last success pipeline:" $LAST_JOB
- export PACKAGE_JOB=$(curl -s "https://gitlab.ostserver.fr/api/v4/projects/1/pipelines/${LAST_JOB}/jobs" | jq -r '.[] | select(.name=="package-deb" and .status=="success") | .id' | head -1)
- echo "Package job ID:" $PACKAGE_JOB
- wget --user-agent="Mozilla/5.0" "https://gitlab.ostserver.fr/gilles/OST/-/jobs/${PACKAGE_JOB}/artifacts/download?file_type=archive" -O artifacts.zip
- unzip -l artifacts.zip
- unzip artifacts.zip -d /tmp/
- apt-get install -y /tmp/packages/ostserver_*_amd64.deb
script:
- mkdir build install
- cd build
- cmake ..
- make -j4
- cmake --install . --prefix=../install
- cd ..
- echo "Contents of install directory:"
- ls -la install/
- find install/ -type f | head -20
artifacts:
paths:
- install/
expire_in: 1 hour
test-job:
stage: test
image: ubuntu:24.04
tags:
- cmake
dependencies:
- build-job
before_script:
- apt-get update
- apt-get clean
- apt-get install -y software-properties-common curl jq unzip wget
- apt-add-repository ppa:mutlaqja/ppa
- apt-get update
- apt-get install -y npm qtbase5-dev libqt5websockets5-dev libindi-dev libstellarsolver-dev libnova-dev libgsl-dev wcslib-dev libcfitsio-dev libavahi-client-dev libavahi-common-dev zlib1g-dev dpkg-dev debhelper devscripts libopencv-dev qtmultimedia5-dev libqt5scxml5-dev
- npm install ws
- echo "Downloading ostserver from OST project artifacts..."
- export LAST_JOB=$(curl -s "https://gitlab.ostserver.fr/api/v4/projects/1/pipelines" | jq -r '.[] | select(.status=="success") | .id' | head -1)
- echo "Last success pipeline:" $LAST_JOB
- export PACKAGE_JOB=$(curl -s "https://gitlab.ostserver.fr/api/v4/projects/1/pipelines/${LAST_JOB}/jobs" | jq -r '.[] | select(.name=="package-deb" and .status=="success") | .id' | head -1)
- echo "Package job ID:" $PACKAGE_JOB
- wget --user-agent="Mozilla/5.0" "https://gitlab.ostserver.fr/gilles/OST/-/jobs/${PACKAGE_JOB}/artifacts/download?file_type=archive" -O artifacts.zip
- unzip -l artifacts.zip
- unzip artifacts.zip -d /tmp/
- apt-get install -y /tmp/packages/ostserver_*_amd64.deb
script:
- mkdir media
- export QT_QPA_PLATFORM=offscreen
- export PATH="./install/usr/bin:$PATH"
- export LD_LIBRARY_PATH="./install/usr/lib:$LD_LIBRARY_PATH"
- ostserver --webroot=media --libpath=./install/usr/lib > server.log 2>&1 &
- SERVER_PID=$!
- sleep 30
- ps aux | grep ostserver | grep -v grep
- echo "Testing server with modules..."
- node test-ws.js 2>&1 | tee ws.log
- echo "Server logs:"
- tail -50 server.log
- kill $SERVER_PID || true
artifacts:
paths:
- server.log
- ws.log
expire_in: 1 week
only:
- master
- tags
- gitlab-ci
package-deb:
stage: package
image: ubuntu:24.04
tags:
- cmake
dependencies:
- build-job
before_script:
- apt-get update
- apt-get install -y dpkg-dev debhelper devscripts lintian
script:
- ls -la
- test -d install
- export PACKAGE_NAME="ostmodules"
- export PACKAGE_VERSION="${CI_COMMIT_TAG#v}"
- export PACKAGE_VERSION="${PACKAGE_VERSION:-1.0.0-${CI_COMMIT_SHORT_SHA}}"
- export PACKAGE_ARCH="amd64"
- export DEB_NAME="${PACKAGE_NAME}_${PACKAGE_VERSION}_${PACKAGE_ARCH}"
- mkdir -p "${DEB_NAME}/DEBIAN" "${DEB_NAME}/usr/share/doc/${PACKAGE_NAME}"
- cp -r install/. "${DEB_NAME}/"
- echo "Package:${PACKAGE_NAME}" > "${DEB_NAME}/DEBIAN/control"
- echo "Version:${PACKAGE_VERSION}" >> "${DEB_NAME}/DEBIAN/control"
- echo "Section:misc" >> "${DEB_NAME}/DEBIAN/control"
- echo "Priority:optional" >> "${DEB_NAME}/DEBIAN/control"
- echo "Architecture:${PACKAGE_ARCH}" >> "${DEB_NAME}/DEBIAN/control"
- echo "Maintainer:Gilles <gilles@ostserver.fr>" >> "${DEB_NAME}/DEBIAN/control"
- echo "Depends:ostserver, libqt5core5a, libqt5gui5, libindi1, libstellarsolver, libnova-0.16-0, libgsl27, libcfitsio10, libavahi-client3, zlib1g, libqt5multimedia5, libqt5scxml5" >> "${DEB_NAME}/DEBIAN/control"
- echo "Description:OST Modules - Collection of modules for OST Server" >> "${DEB_NAME}/DEBIAN/control"
- echo "#!/bin/bash" > "${DEB_NAME}/DEBIAN/postinst"
- echo "set -e" >> "${DEB_NAME}/DEBIAN/postinst"
- echo "exit 0" >> "${DEB_NAME}/DEBIAN/postinst"
- chmod 755 "${DEB_NAME}/DEBIAN/postinst"
- mkdir -p packages
- dpkg-deb --build "${DEB_NAME}" packages/
- lintian packages/"${DEB_NAME}.deb" || true
artifacts:
paths:
- packages/*.deb
expire_in: 1 week
only:
- master
- tags
- gitlab-ci
release-assets:
stage: release
image: curlimages/curl:latest
tags:
- cmake
dependencies:
- package-deb
script:
- export PACKAGE_VERSION="${CI_COMMIT_TAG#v}"
- export PROJECT_ID="${CI_PROJECT_ID}"
- export PACKAGE_NAME="ostmodules_${PACKAGE_VERSION}_amd64.deb"
- curl --header "JOB-TOKEN:${CI_JOB_TOKEN}" --upload-file "packages/${PACKAGE_NAME}" "${CI_API_V4_URL}/projects/${PROJECT_ID}/packages/generic/ostmodules/${PACKAGE_VERSION}/${PACKAGE_NAME}"
only:
- tags