summary refs log tree commit diff
path: root/.gitlab-ci.yml
blob: b314d4652da1f764116c99c324c3e3ded44eeb94 (plain) (blame)
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
variables:
  CCACHE_COMPILERCHECK: content
  CCACHE_DIR: "${CI_PROJECT_DIR}/.ccache"
  # prevent configure tzdata hanging apt install commands
  DEBIAN_FRONTEND: noninteractive

build-clazy:
  stage: build
  image: ubuntu:22.04
  tags: [docker]
  variables:
    CLAZY_CHECKS: level0,level1,no-non-pod-global-static
    TRAVIS_OS_NAME: linux
  before_script:
    - apt-get update
    - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake liblmdb-dev 
        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev 
        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev 
        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform 
        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev 
  script:
    - export PATH="/usr/local/bin/:/usr/lib/ccache:${PATH}"
    - export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l)
    - cmake -GNinja -H. -Bbuild
        -DCMAKE_INSTALL_PREFIX=.deps/usr
        -DHUNTER_ENABLED=OFF -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_MTXCLIENT=ON -DUSE_BUNDLED_COEURL=ON -DUSE_BUNDLED_LMDBXX=ON -DUSE_BUNDLED_OLM=ON
        -DVOIP=OFF
        -DCMAKE_BUILD_TYPE=Release
        -DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF -DCMAKE_CXX_COMPILER=clazy
    - cmake --build build
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - .ccache

build-gcc11:
  stage: build
  image: ubuntu:22.04
  tags: [docker]
  variables:
    TRAVIS_OS_NAME: linux
  before_script:
    - apt-get update
    - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev 
        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev 
        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev 
        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform 
        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev 
    # need recommended deps for wget
    - apt-get -y install wget
    - /usr/sbin/update-ccache-symlinks
    - rm -rf ../.hunter &&  mv .hunter ../.hunter || true
  script:
    - export PATH="/usr/lib/ccache:${PATH}"
    - cmake -GNinja -H. -Bbuild
        -DCMAKE_INSTALL_PREFIX=.deps/usr
        -DHUNTER_ROOT="../.hunter"
        -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_LMDB=OFF -DUSE_BUNDLED_QTKEYCHAIN=OFF
        -DVOIP=OFF
        -DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release
        -DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF
        -DJSON_ImplicitConversions=OFF
    - cmake --build build
  after_script:
    - mv ../.hunter .hunter
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - .hunter/
      - .ccache

build-gcc10:
  stage: build
  image: debian:bullseye
  tags: [docker]
  variables:
    TRAVIS_OS_NAME: linux
  before_script:
    - apt-get update
    - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev 
        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev 
        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev 
        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform 
        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev 
    # need recommended deps for wget
    - apt-get -y install wget
    - /usr/sbin/update-ccache-symlinks
    - rm -rf ../.hunter &&  mv .hunter ../.hunter || true
  script:
    - export PATH="/usr/lib/ccache:${PATH}"
    - cmake -GNinja -H. -Bbuild
        -DCMAKE_INSTALL_PREFIX=.deps/usr
        -DHUNTER_ROOT="../.hunter"
        -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_LMDB=OFF -DUSE_BUNDLED_QTKEYCHAIN=OFF
        -DVOIP=OFF
        -DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release
        -DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF
        -DJSON_ImplicitConversions=OFF
        -DMAN=OFF
    - cmake --build build
  after_script:
    - mv ../.hunter .hunter
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - .hunter/
      - .ccache

build-macos:
  stage: build
  tags: [macos]
  before_script:
    - rm -rf ../.hunter &&  mv .hunter ../.hunter || true
  script:
    - export PATH=/usr/local/opt/qt@5/bin/:${PATH}
    - export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5
    - cmake -GNinja -H. -Bbuild
        -DCMAKE_BUILD_TYPE=RelWithDebInfo
        -DCMAKE_INSTALL_PREFIX=.deps/usr
        -DHUNTER_ROOT="../.hunter"
        -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
        -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo
        -DUSE_BUNDLED_OPENSSL=ON
        -DUSE_BUNDLED_BOOST=ON
        -DCI_BUILD=ON
        -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
    - cmake --build build
    - (cd build && git clone https://github.com/Nheko-Reborn/qt-jdenticon.git && cd qt-jdenticon && qmake && make -j 4 && cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS)
  after_script:
    - mv ../.hunter .hunter
  artifacts:
    paths:
      - build/nheko.app
    name: nheko-${CI_COMMIT_SHORT_SHA}-macos-app
    expose_as: 'macos-app'
    public: false
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .hunter/
      - "${CCACHE_DIR}"

codesign-macos:
  stage: deploy
  tags: [macos]
  before_script:
    - 'brew upgrade qt@5'
    - pip3 install dmgbuild
  script:
    - export PATH=/usr/local/opt/qt@5/bin/:${PATH}
    - ./.ci/macos/notarize.sh
  after_script:
    - ./.ci/upload-nightly-gitlab.sh artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg
  needs:
    - build-macos
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
    - if : $CI_COMMIT_TAG
  artifacts:
    paths:
      - artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg
      - /tmp/notarize*
    name: nheko-${CI_COMMIT_SHORT_SHA}-macos

build-flatpak-amd64:
  stage: build
  image: ubuntu:latest
  #image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
  tags: [docker]
  before_script:
    - apt-get update && apt-get -y install flatpak-builder git python3 curl python3-aiohttp python3-tenacity gir1.2-ostree-1.0
    - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    - flatpak --noninteractive install --user flathub org.kde.Platform//5.15-22.08
    - flatpak --noninteractive install --user flathub org.kde.Sdk//5.15-22.08
  script:
    - export VERSION=$(git describe)
    - mkdir -p build-flatpak
    - cd build-flatpak
    - flatpak-builder --user --disable-rofiles-fuse --ccache --repo=repo --default-branch=${CI_COMMIT_REF_NAME//\//_} --subject="Build of Nheko ${VERSION} `date`" app ../io.github.NhekoReborn.Nheko.yaml
    - flatpak build-bundle repo nheko-amd64.flatpak io.github.NhekoReborn.Nheko ${CI_COMMIT_REF_NAME//\//_}
  after_script:
    - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
    - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-amd64.flatpak
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - build-flatpak/.flatpak-builder/
  artifacts:
    expose_as: 'flatpak-amd64'
    paths: ['build-flatpak/nheko-amd64.flatpak']
    name: flatpak-${CI_COMMIT_REF_NAME}-${VERSION}-amd64

build-flatpak-arm64:
  stage: build
  image: ubuntu:latest
  #image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
  tags: [docker-arm64]
  before_script:
    - apt-get update && apt-get -y install flatpak-builder git python3 curl python3-aiohttp python3-tenacity gir1.2-ostree-1.0
    - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    - flatpak --noninteractive install --user flathub org.kde.Platform//5.15-22.08
    - flatpak --noninteractive install --user flathub org.kde.Sdk//5.15-22.08
  script:
    - export VERSION=$(git describe)
    - mkdir -p build-flatpak
    - cd build-flatpak
    - flatpak-builder --user --disable-rofiles-fuse --ccache --repo=repo --default-branch=${CI_COMMIT_REF_NAME//\//_} --subject="Build of Nheko ${VERSION} `date` for arm64" app ../io.github.NhekoReborn.Nheko.yaml
    - flatpak build-bundle repo nheko-arm64.flatpak io.github.NhekoReborn.Nheko ${CI_COMMIT_REF_NAME//\//_}
  after_script:
    - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
    - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-arm64.flatpak
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - build-flatpak/.flatpak-builder/
  artifacts:
    expose_as: 'flatpak-arm64'
    paths: ['build-flatpak/nheko-arm64.flatpak']
    name: flatpak-${CI_COMMIT_REF_NAME}-${VERSION}-arm64

linting:
  stage: build
  image: alpine:latest
  tags: [docker]
  before_script:
    - apk update && apk add make git python3 py3-pip
    - apk add clang-extra-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
    - export PATH="$PATH:/root/.local/bin"
    - pip3 install --user reuse
  script:
    - make lint
    - make license