-
Notifications
You must be signed in to change notification settings - Fork 81
203 lines (170 loc) · 6.22 KB
/
Copy pathlinux.yml
File metadata and controls
203 lines (170 loc) · 6.22 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: linux Build
on:
push:
paths:
- 'vcpkg/**'
- 'vcpkg.json'
- 'VCPKG_BASELINE'
- 'app/**'
- 'core/**'
- 'scripts/**'
- 'cmake/**'
- 'cmake_templates/**'
- 'test/**'
- 'CMakeLists.txt'
- '.github/workflows/linux.yml'
release:
types:
- published
env:
CMAKE_VERSION: '4.3.2'
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
VCPKG_ROOT: "${{ github.workspace }}/vcpkg"
TRIPLET: x64-linux
concurrency:
group: ci-${{github.ref}}-linux
cancel-in-progress: true
jobs:
linux_build:
if: ( github.repository == 'MerginMaps/mobile' ) && (!contains(github.event.head_commit.message, 'Translate '))
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
path: mm
- name: Free disk space
uses: insightsengineering/disk-space-reclaimer@v1
- name: Install build dependencies
run: |
# remove enzu mirror, which was breaking the CI build
sudo rm /etc/apt/sources.list
sudo apt-get update -y
sudo apt-get install -y \
gperf autopoint '^libxcb.*-dev' libx11-xcb-dev libegl1-mesa-dev \
libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev \
autoconf-archive libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0 libfuse2t64 \
lcov nasm libxrandr-dev mono-complete xvfb libltdl-dev libwayland-dev libwayland-egl-backend-dev \
wayland-protocols
# Required to run unit tests on linux
echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ env.CMAKE_VERSION }}
- name: Extract Mergin API_KEY
env:
MERGINSECRETS_DECRYPT_KEY: ${{ secrets.MERGINSECRETS_DECRYPT_KEY }}
run: |
cd mm/core/
openssl \
aes-256-cbc -d \
-in merginsecrets.cpp.enc \
-out merginsecrets.cpp \
-k "$MERGINSECRETS_DECRYPT_KEY" \
-md md5
- name: Ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ccache-${{ env.TRIPLET }}
max-size: 200M
- name: Install VCPKG
shell: bash
run: |
mkdir -p "${{ env.VCPKG_ROOT }}"
cd "${{ env.VCPKG_ROOT }}"
git init
git remote add origin https://github.com/microsoft/vcpkg.git
git pull origin master
VCPKG_TAG=`cat ${{ github.workspace }}/mm/VCPKG_BASELINE`
git checkout ${VCPKG_TAG}
cd "${{ env.VCPKG_ROOT }}"
chmod +x ./bootstrap-vcpkg.sh
./bootstrap-vcpkg.sh
- name: Setup NuGet credentials
shell: bash
run: |
${{ env.VCPKG_ROOT }}/vcpkg fetch nuget
mono `${{ env.VCPKG_ROOT }}/vcpkg fetch nuget | head -n 1` \
sources add \
-source "https://nuget.pkg.github.com/merginmaps/index.json" \
-storepasswordincleartext \
-name "GitHub" \
-username "mergin-maps-bot" \
-password "${{ secrets.MERGIN_MAPS_BOT_GITHUB_TOKEN }}"
mono `${{ env.VCPKG_ROOT }}/vcpkg fetch nuget | head -n 1` \
setapikey "${{ secrets.MERGIN_MAPS_BOT_GITHUB_TOKEN }}" \
-source "https://nuget.pkg.github.com/merginmaps/index.json"
- name: Calculate build number
run: |
BUILD_NUM=$GITHUB_RUN_NUMBER$GITHUB_RUN_ATTEMPT
echo "MM_VERSION_CODE=${BUILD_NUM}" >> $GITHUB_ENV
echo "Version code: ${BUILD_NUM}"
- name: Build app (debug)
run: |
mkdir -p build-mm-db
cd build-mm-db
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_TARGET_TRIPLET=${{ env.TRIPLET }} \
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake \
-DUSE_KEYCHAIN=No \
-DUSE_MM_SERVER_API_KEY=TRUE \
-DCOVERAGE=TRUE \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DENABLE_TESTS=TRUE \
-GNinja \
-S ../mm
ninja
- name: Run tests
env:
QT_QPA_PLATFORM: "offscreen"
run: |
cd build-mm-db/
xvfb-run --server-args="-screen 0 640x480x24" ctest --output-on-failure
- name: Build lcov summary
run: |
cd build-mm-db
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*/vcpkg_installed/*' '*/merginsecrets.cpp' '*/test/*' '/usr/*' '*build-mm-db/*' --output-file coverage.info
lcov --list coverage.info
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: build-mm-db/coverage.info
fail-on-error: false
- name: Build app (release)
run: |
mkdir -p install-mm
mkdir -p build-mm
cd build-mm
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=${{ env.TRIPLET }} \
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_INSTALL_PREFIX:PATH=../install-mm \
-DUSE_MM_SERVER_API_KEY=TRUE \
-DUSE_KEYCHAIN=No \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-GNinja \
-S ../mm
ninja
ninja install
- name: Get timestamp
id: time
uses: josStorer/get-current-time@v2.0.2
with:
format: 'YYYYMMDD'
- name: Package app
run: |
MM_TAR=input-${{ env.MM_VERSION_CODE }}-${{ steps.time.outputs.formattedTime }}-${{ github.run_number }}.tar.gz
echo "MM_TAR=${MM_TAR}" >> $GITHUB_ENV
cd ${{ github.workspace }}/install-mm
find .
tar -c -z -f ${{ github.workspace }}/${MM_TAR} ./
- name: Upload app to artifacts
uses: actions/upload-artifact@v6
with:
path: ${{ github.workspace }}/${{ env.MM_TAR }}
name: Mergin Maps ${{ env.MM_VERSION_CODE }} x86_64