summary refs log tree commit diff
path: root/.gitlab-ci.yml
blob: 2ecfa17ccd2b3e92f94cc6a61ecd2306642b0901 (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
variables:
  CCACHE_COMPILERCHECK: content
  CCACHE_DIR: "${CI_PROJECT_DIR}/.ccache"
  # prevent configure tzdata hanging apt install commands
  DEBIAN_FRONTEND: noninteractive

build-gcc7:
  stage: build
  image: ubuntu:16.04
  tags: [docker]
  variables:
    CXX: g++-7
    CC: gcc-7
    QT_PKG: 510
    TRAVIS_OS_NAME: linux
  before_script:
    - apt-get update
    - apt-get install -y software-properties-common
    - add-apt-repository ppa:ubuntu-toolchain-r/test -y
    - add-apt-repository ppa:beineri/opt-qt-5.10.1-xenial -y
    - apt-get update && apt-get -y install --no-install-recommends g++-7 build-essential ninja-build qt${QT_PKG}{base,declarative,tools,multimedia,script,quickcontrols2,svg} liblmdb-dev libgl1-mesa-dev libssl-dev git ccache
    # need recommended deps for wget
    - apt-get -y install wget
    - wget https://github.com/Kitware/CMake/releases/download/v3.19.0/cmake-3.19.0-Linux-x86_64.sh && sh cmake-3.19.0-Linux-x86_64.sh  --skip-license  --prefix=/usr/local
    - /usr/sbin/update-ccache-symlinks
    - update-alternatives --install /usr/bin/gcc gcc "/usr/bin/${CC}" 10
    - update-alternatives --install /usr/bin/g++ g++ "/usr/bin/${CXX}" 10
    - update-alternatives --set gcc "/usr/bin/${CC}"
    - update-alternatives --set g++ "/usr/bin/${CXX}"
  script:
    - export PATH="/usr/lib/ccache:${PATH}"
    - export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l)
    - export PATH="/usr/local/bin/:${PATH}"
    - . "/opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh" || true
    - mkdir -p .deps/usr .hunter
    - mkdir -p build
    - cmake -GNinja -H. -Bbuild
        -DCMAKE_INSTALL_PREFIX=.deps/usr
        -DHUNTER_ROOT=".hunter"
        -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
        -DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release
        -DCI_BUILD=ON
    - cmake --build build
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - .hunter/
      - .ccache

build-macos:
  stage: build
  tags: [macos]
  before_script:
    - brew update
    - brew bundle --file=./.ci/macos/Brewfile
    - pip3 install dmgbuild
  script:
    - export PATH=/usr/local/opt/qt/bin/:${PATH}
    - export CMAKE_PREFIX_PATH=/usr/local/opt/qt5
    - 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
    - cmake --build build
  after_script:
    - ./.ci/macos/deploy.sh
    - ./.ci/upload-nightly-gitlab.sh artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg
  artifacts:
    paths:
      - artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg
    name: nheko-${CI_COMMIT_SHORT_SHA}-macos
    expose_as: 'macos-dmg'
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .hunter/
      - "${CCACHE_DIR}"

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 python curl
    - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    - flatpak --noninteractive install --user flathub org.kde.Platform//5.15
    - flatpak --noninteractive install --user flathub org.kde.Sdk//5.15
  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.json
    - flatpak build-bundle repo nheko-amd64.flatpak io.github.NhekoReborn.Nheko ${CI_COMMIT_REF_NAME}
  after_script:
    - 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 python curl
    - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    - flatpak --noninteractive install --user flathub org.kde.Platform//5.15
    - flatpak --noninteractive install --user flathub org.kde.Sdk//5.15
  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.json
    - flatpak build-bundle repo nheko-arm64.flatpak io.github.NhekoReborn.Nheko ${CI_COMMIT_REF_NAME}
  after_script:
    - 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 clang make git
  script:
    - make lint