From 58afa92298d12c730ddf7ba29653d07252cdeeeb Mon Sep 17 00:00:00 2001 From: Jonas Strassel Date: Mon, 25 Jan 2021 01:56:54 +0100 Subject: [PATCH] refactor: move coverage and script steps into gh ci --- .github/workflows/ci.yml | 65 ++++++++++++++++++++++++++++++++-------- ci/ci-continuous.sh | 58 ----------------------------------- ci/ci-coverity.sh | 37 ----------------------- 3 files changed, 53 insertions(+), 107 deletions(-) delete mode 100755 ci/ci-continuous.sh delete mode 100755 ci/ci-coverity.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d36461e2..25e27b431 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,18 +2,25 @@ name: ci on: push: + branches: + - calamares + pull_request: + types: + - opened + - reopened + - synchronize workflow_dispatch: - #schedule: - # - cron: '30 * * * *' env: BUILDDIR: /build - SRCDIR: /src + SRCDIR: ${{ github.workspace }} + DESTDIR: /INSTALL_ROOT CMAKE_ARGS: | -DCMAKE_BUILD_TYPE=Release -DWEBVIEW_FORCE_WEBKIT=1 -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DWITH_PYTHONQT=OFF" + -DCMAKE_BUILD_TYPE=Debug jobs: build: @@ -24,9 +31,18 @@ jobs: steps: - name: prepare + env: + COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} run: | sudo apt-get update sudo apt-get -y install git-core + if [ -n "$COVERITY_SCAN_TOKEN" ]; then + curl -k -o coverity_tool.tar.gz \ + -d "token=$COVERITY_SCAN_TOKEN&project=calamares%2Fcalamares" \ + https://scan.coverity.com/download/cxx/linux64 + mkdir "$BUILDDIR/coveritytool" + tar xvf coverity_tool.tar.gz -C "$BUILDDIR/coveritytool" --strip-components 2 + fi - name: checkout uses: actions/checkout@v2 @@ -62,16 +78,41 @@ jobs: qttools5-dev \ qttools5-dev-tools - - name: config + name: check environment run: | + test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } test -n "$SRCDIR" || { echo "! \$SRCDIR not set" ; exit 1 ; } - mkdir -p $SRCDIR $BUILDDIR - test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } - test -n "$COVERITY_SCAN_TOKEN" || { echo "! Missing Coverity token" ; exit 1 ; } - - - name: continuous + mkdir -p $BUILDDIR $SRCDIR $DESTDIR + - + name: cmake + run: cmake $CMAKE_ARGS $SRCDIR + - + name: generate coverage report + env: + COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} run: | - test -x "ci/ci-continuous.sh" || { echo "! Missing ci-continuous.sh" ; exit 1 ; } - exec "ci/ci-continuous.sh" - # irc notification to chat.freenode.net#calamares \ No newline at end of file + if [ -n "$COVERITY_SCAN_TOKEN" ]; then + $BUILDDIR/coveritytool/bin/cov-build --dir cov-int make -j2 + tar caf calamares-ci.tar.xz cov-int + curl -k --form token=$COVERITY_SCAN_TOKEN \ + --form email=groot@kde.org \ + --form file=@calamares-ci.tar.xz \ + --form version="calamares-`date -u +%Y%m%d`" \ + --form description="calamares on `date -u`" \ + https://scan.coverity.com/builds?project=calamares%2Fcalamares + fi + - + name: make + run: make -j2 VERBOSE=1 + - + name: build results + run: ls -la $( find "$BUILDDIR" -type f -name '*.so' ) + - + name: install + id: install + run: make install VERBOSE=1 + - + name: debug install + if: ${{ failure() && steps.install.outcome == 'failure' }} + run: ls -la $( find "$DESTDIR" -type f -name '*.so' ) \ No newline at end of file diff --git a/ci/ci-continuous.sh b/ci/ci-continuous.sh deleted file mode 100755 index b99786c70..000000000 --- a/ci/ci-continuous.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh -# -# SPDX-FileCopyrightText: 2017 Adriaan de Groot -# SPDX-License-Identifier: BSD-2-Clause -# -# CI script for use on every-commit: -# - build and install Calamares -# -test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } -test -n "$SRCDIR" || { echo "! \$SRCDIR not set" ; exit 1 ; } - -test -d $BUILDDIR || { echo "! $BUILDDIR not a directory" ; exit 1 ; } -test -d $SRCDIR || { echo "! $SRCDIR not a directory" ; exit 1 ; } -test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } - -cd $BUILDDIR || exit 1 - -section() { -echo "###" -echo "### $1" -echo "###" -pwd -P -df -h -} - -section "cmake $CMAKE_ARGS $SRCDIR" -cmake $CMAKE_ARGS $SRCDIR || { echo "! CMake failed" ; exit 1 ; } - -section "make" -make -j2 VERBOSE=1 || { echo "! Make recheck" ; pwd -P ; df -h ; make -j1 VERBOSE=1 ; echo "! Make failed" ; exit 1 ; } - -section "make install" - -install_debugging() { - ls -la $( find "$1" -type f -name '*.so' ) -} - -echo "# Build results" -install_debugging "$BUILDDIR" - -echo "# Install" -DESTDIR=/build/INSTALL_ROOT -mkdir -p "$DESTDIR" - -if make install VERBOSE=1 DESTDIR="$DESTDIR" ; -then - echo "# .. install OK" - result=true -else - echo "# .. install failed" - result=false -fi - - -section "Install results" -install_debugging "$DESTDIR" - -$result || { echo "! Install failed" ; exit 1 ; } # Result of make install, above diff --git a/ci/ci-coverity.sh b/ci/ci-coverity.sh deleted file mode 100755 index d714ca946..000000000 --- a/ci/ci-coverity.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh -# -# SPDX-FileCopyrightText: 2017 Adriaan de Groot -# SPDX-License-Identifier: BSD-2-Clause -# -# CI script for weekly (cron) use: -# - use the coverity tool to build and and upload results -# -test -n "$COVERITY_SCAN_TOKEN" || { echo "! Missing Coverity token" ; exit 1 ; } -test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } -test -n "$SRCDIR" || { echo "! \$SRCDIR not set" ; exit 1 ; } - -test -d $BUILDDIR || { echo "! $BUILDDIR not a directory" ; exit 1 ; } -test -d $SRCDIR || { echo "! $SRCDIR not a directory" ; exit 1 ; } -test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } - -cd $BUILDDIR || exit 1 - -curl -k -o coverity_tool.tar.gz \ - -d "token=$COVERITY_SCAN_TOKEN&project=calamares%2Fcalamares" \ - https://scan.coverity.com/download/cxx/linux64 || exit 1 -mkdir "$BUILDDIR/coveritytool" -tar xvf coverity_tool.tar.gz -C "$BUILDDIR/coveritytool" --strip-components 2 -export PATH="$BUILDDIR/coveritytool/bin:$PATH" - -echo "# cmake -DCMAKE_BUILD_TYPE=Debug $CMAKE_ARGS $SRCDIR" -cmake -DCMAKE_BUILD_TYPE=Debug $CMAKE_ARGS $SRCDIR || exit 1 -cov-build --dir cov-int make -j2 - -tar caf calamares-ci.tar.xz cov-int - -curl -k --form token=$COVERITY_SCAN_TOKEN \ - --form email=groot@kde.org \ - --form file=@calamares-ci.tar.xz \ - --form version="calamares-`date -u +%Y%m%d`" \ - --form description="calamares on `date -u`" \ - https://scan.coverity.com/builds?project=calamares%2Fcalamares