aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: b147413384d32d5788b65f3283635837680b4902 (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
name: CI

on:
  push:
  pull_request:
    types: [opened, reopened]

defaults:
  run:
    shell: bash

jobs:
  CI:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      max-parallel: 1
      matrix:
        os: [ubuntu-18.04, macos-10.15]
        e2ee: [e2ee, '']
        compiler: [ GCC, Clang ]
        exclude:
        - os: macos-10.15
          compiler: GCC

    env:
      DESTDIR: ${{ github.workspace }}
      CMAKE_ARGS: '-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=${{ github.workspace }}/usr'

    steps:
    - uses: actions/checkout@v2
      with:
        submodules: ${{ matrix.e2ee != '' }}

    - name: Cache Qt
      id: cache-qt
      uses: actions/cache@v2
      with:
        path: ${{ runner.workspace }}/Qt
        key: ${{ runner.os }}-QtCache

    - name: Install Qt
      uses: jurplel/install-qt-action@v2.11.1
      with:
        version: '5.9.9'
        cached: ${{ steps.cache-qt.outputs.cache-hit }}

    - name: Create Build Environment
      run: |
        if [ "${{ matrix.compiler }}" == "GCC" ]; then
          echo "CC=gcc" >>$GITHUB_ENV
          echo "CXX=g++" >>$GITHUB_ENV
        else
          echo "CC=clang" >>$GITHUB_ENV
          echo "CXX=clang++" >>$GITHUB_ENV
        fi
        echo "QUOTEST_ORIGIN=${{ runner.os }}/${{ matrix.compiler }}" >>$GITHUB_ENV
        cmake -E make_directory ${{ runner.workspace }}/build

    - name: Build and install olm
      if: ${{ matrix.e2ee != '' }}
      run: |
        git clone https://gitlab.matrix.org/matrix-org/olm.git
        pushd olm
        cmake . -Bbuild $CMAKE_ARGS
        cmake --build build --target install
        popd
        echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN, E2EE" >>$GITHUB_ENV

    - name: Configure libQuotient
      run: |
        cmake $GITHUB_WORKSPACE -Bbuild $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee == 'e2ee' }}

    - name: Build and install libQuotient
      run: cmake --build build --target install

    - name: Build tests
      run: |
        cmake tests -Bbuild-test $CMAKE_ARGS
        cmake --build build-test --target all
        
    - name: Run tests
      env:
        TEST_USER: ${{ secrets.TEST_USER }}
        TEST_PWD: ${{ secrets.TEST_PWD }}
      run: build-test/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN"