blob: ae96aebcea155636582e2a6b2ac4b7cbb37bb76e (
plain)
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
|
name: Sonar
on:
push:
pull_request:
types: [opened, reopened]
defaults:
run:
shell: bash
jobs:
SonarCloud:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
qt-version: [ '5.12.10' ]
e2ee: [ 'e2ee' ]
update-api: [ '' ]
env:
SONAR_SCANNER_VERSION: 4.6.2.2472
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build/sonar
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: ${{ matrix.e2ee != '' }}
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ${{ runner.workspace }}/Qt
key: ${{ runner.os }}-Qt${{ matrix.qt-version }}-cache
- name: Install Qt
uses: jurplel/install-qt-action@v2.11.1
with:
version: ${{ matrix.qt-version }}
# arch: ${{ matrix.qt-arch }} # Only Windows needs that
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Setup build environment
run: |
echo "CC=gcc-10" >>$GITHUB_ENV
echo "CXX=g++-10" >>$GITHUB_ENV
mkdir -p $HOME/.sonar
echo "CMAKE_ARGS=-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=false \
-DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local" >>$GITHUB_ENV
cmake -E make_directory ${{ runner.workspace }}/build
- name: Build and install olm
if: matrix.e2ee
run: |
cd ..
git clone https://gitlab.matrix.org/matrix-org/olm.git
cmake -S olm -B olm/build $CMAKE_ARGS
cmake --build olm/build --target install
- name: Pull CS API and build GTAD
if: matrix.update-api
run: |
cd ..
git clone https://github.com/quotient-im/matrix-doc.git
git clone --recursive https://github.com/KitsuneRal/gtad.git
cmake -S gtad -B gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF
cmake --build gtad
echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=$GITHUB_WORKSPACE/../matrix-doc \
-DGTAD_PATH=$GITHUB_WORKSPACE/../gtad/gtad" \
>>$GITHUB_ENV
- name: Download and set up Sonar Cloud tools
run: |
pushd $HOME/.sonar
curl -sSLo build-wrapper.zip $SONAR_SERVER_URL/static/cpp/build-wrapper-linux-x86.zip
unzip -o build-wrapper.zip
echo "BUILD_WRAPPER=$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux* --out-dir $BUILD_WRAPPER_OUT_DIR" >>$GITHUB_ENV
curl -sSLo sonar-scanner.zip \
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o sonar-scanner.zip
popd
- name: Configure libQuotient
run: |
if [[ '${{ runner.os }}' == 'Windows' ]]; then
BIN_DIR=.
else
BIN_DIR=bin
fi
echo "BIN_DIR=$BIN_DIR" >>$GITHUB_ENV
cmake -S $GITHUB_WORKSPACE -B build $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }}
- name: Regenerate API code
if: matrix.update-api
run: cmake --build build --target update-api
- name: Build libQuotient
run: |
$BUILD_WRAPPER cmake --build build --target all
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
$HOME/.sonar/sonar-scanner*/bin/sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|