From 835b6f98384100437ca90797555f5b050a53851a Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 2 Jan 2021 15:55:44 +0100 Subject: Backport .github/workflows/ci.yml from master Mostly taken from #434, except removed E2EE matrix variants since E2EE is not ready on 0.6.x and is discouraged from using. --- .github/workflows/ci.yml | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/ci.yml (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..02092c10 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +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] + compiler: [ GCC, Clang ] + # Not using binary values here, to make the job captions more readable + update-api: [ '', 'update-api' ] + exclude: + - os: macos-10.15 + compiler: GCC + + steps: + - uses: actions/checkout@v2 + with: + submodules: false + + - 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: Install Valgrind + if: contains(matrix.os, 'ubuntu') + run: | + sudo apt-get install valgrind + echo "VALGRIND=valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=tests/.valgrind.supp" >>$GITHUB_ENV + + - name: Setup build environment + run: | + if [ "${{ matrix.compiler }}" == "GCC" ]; then + if [ -n "${{ matrix.update-api }}" ]; then VERSION_POSTFIX='-8'; fi + echo "CC=gcc$VERSION_POSTFIX" >>$GITHUB_ENV + echo "CXX=g++$VERSION_POSTFIX" >>$GITHUB_ENV + else + echo "CC=clang" >>$GITHUB_ENV + echo "CXX=clang++" >>$GITHUB_ENV + fi + echo "QUOTEST_ORIGIN=${{ runner.os }}/${{ matrix.compiler }}" >>$GITHUB_ENV + echo "DESTDIR=${{ runner.workspace }}" >>$GITHUB_ENV + echo "CMAKE_ARGS=-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=${{ runner.workspace }}/usr" >>$GITHUB_ENV + cmake -E make_directory ${{ runner.workspace }}/build + + - name: Pull API definitions and build GTAD + if: matrix.update-api + run: | + cd ${{ runner.workspace }} + git clone https://github.com/matrix-org/matrix-doc.git + git clone --recursive https://github.com/KitsuneRal/gtad.git + pushd gtad + cmake . $CMAKE_ARGS + cmake --build . + popd + echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=${{ runner.workspace }}/matrix-doc -DGTAD_PATH=${{ runner.workspace }}/gtad/gtad" >>$GITHUB_ENV + echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with generated API files" >>$GITHUB_ENV + + - name: Configure libQuotient + run: cmake -S $GITHUB_WORKSPACE -B build $CMAKE_ARGS + + - name: Generate API files + if: matrix.update-api + run: cmake --build build --target update-api + + - 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: $VALGRIND build-test/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" -- cgit v1.2.3 From 8a4c762c25c97f355eef47051428d5859bf610e2 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 8 Jan 2021 08:37:38 +0100 Subject: Add a timeout to quotest runs The current Quotest gets stuck somewhere, and the its big internal 3-minute watchdog doesn't cut it for some reason. While investigating that, an external timeout would be quite handy. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02092c10..ff5392a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,3 +96,4 @@ jobs: TEST_USER: ${{ secrets.TEST_USER }} TEST_PWD: ${{ secrets.TEST_PWD }} run: $VALGRIND build-test/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" + timeout-minutes: 5 # quotest is supposed to finish within 3 minutes, actually -- cgit v1.2.3 From ddbcacdce5e69fa7cbcaa891540da2815451b6ce Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 12 Jan 2021 18:27:48 +0100 Subject: Don't run the test if TEST_USER is empty --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff5392a9..907a4a34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,5 +95,6 @@ jobs: env: TEST_USER: ${{ secrets.TEST_USER }} TEST_PWD: ${{ secrets.TEST_PWD }} - run: $VALGRIND build-test/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" + run: | + [[ -z "$TEST_USER" ]] || $VALGRIND build-test/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" timeout-minutes: 5 # quotest is supposed to finish within 3 minutes, actually -- cgit v1.2.3