From 27102ad9c1f8a17a536e1f8c31b998815a383e86 Mon Sep 17 00:00:00 2001 From: Morten Borup Petersen Date: Sun, 24 Sep 2023 12:03:20 +0200 Subject: [PATCH] Move CI to github actions --- .github/workflows/build-ubuntu.yml | 101 ++++++++++++++++++ .../workflows/scripts/run_tests.sh | 0 .travis.yml | 80 -------------- ci_scripts/linux/after_success.sh | 1 - ci_scripts/linux/before_install.sh | 5 - ci_scripts/linux/travisbuild.sh | 6 -- ci_scripts/linux_test/after_success.sh | 21 ---- ci_scripts/linux_test/before_install.sh | 10 -- ci_scripts/linux_test/travisbuild.sh | 9 -- ci_scripts/mac/after_success.sh | 0 ci_scripts/mac/before_install.sh | 29 ----- ci_scripts/mac/travisbuild.sh | 15 --- ci_scripts/windows/after_success.sh | 1 - ci_scripts/windows/before_install.sh | 17 --- ci_scripts/windows/travisbuild.sh | 14 --- 15 files changed, 101 insertions(+), 208 deletions(-) create mode 100644 .github/workflows/build-ubuntu.yml rename ci_scripts/run_qtests.sh => .github/workflows/scripts/run_tests.sh (100%) delete mode 100644 .travis.yml delete mode 100644 ci_scripts/linux/after_success.sh delete mode 100644 ci_scripts/linux/before_install.sh delete mode 100644 ci_scripts/linux/travisbuild.sh delete mode 100644 ci_scripts/linux_test/after_success.sh delete mode 100644 ci_scripts/linux_test/before_install.sh delete mode 100644 ci_scripts/linux_test/travisbuild.sh delete mode 100644 ci_scripts/mac/after_success.sh delete mode 100644 ci_scripts/mac/before_install.sh delete mode 100644 ci_scripts/mac/travisbuild.sh delete mode 100644 ci_scripts/windows/after_success.sh delete mode 100644 ci_scripts/windows/before_install.sh delete mode 100644 ci_scripts/windows/travisbuild.sh diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml new file mode 100644 index 0000000..681bbac --- /dev/null +++ b/.github/workflows/build-ubuntu.yml @@ -0,0 +1,101 @@ +name: VSRTL build and test + +on: [push, pull_request] + + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-20.04] + build-type: [Release, Debug] + + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + # Container preparation + # Ubuntu + - if: contains( matrix.os, 'ubuntu') + name: Prepare ubuntu container for build + run: | + sudo apt-get update + sudo apt-get upgrade -y + DEBIAN_FRONTEND=noninteractive sudo apt-get install -y -q --force-yes \ + automake cmake git wget libfuse2 desktop-file-utils tree xvfb \ + build-essential libgl1-mesa-dev libxkbcommon-x11-0 libpulse-dev \ + libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 \ + libxcb-xinerama0 libxcb-composite0 libxcb-cursor0 libxcb-damage0 \ + libxcb-dpms0 libxcb-dri2-0 libxcb-dri3-0 libxcb-ewmh2 libxcb-glx0 \ + libxcb-present0 libxcb-randr0 libxcb-record0 libxcb-render0 libxcb-res0 \ + libxcb-screensaver0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 \ + + echo "CC=gcc-9" >> $GITHUB_ENV + echo "CXX=g++-9" >> $GITHUB_ENV + + # Dummy display server for CI tests + Xvfb :99 & + echo "DISPLAY=:99" >> $GITHUB_ENV + + # MacOS + - if: contains( matrix.os, 'macos') + name: Prepare macos container for build + run: brew install autoconf automake libtool xz pkg-config libgit2 libjpg libpng libmtp + + # Windows + - if: contains( matrix.os, 'windows') + name: Prepare windows container for build + uses: ilammy/msvc-dev-cmd@v1 + - if: contains( matrix.os, 'windows') + uses: seanmiddleditch/gha-setup-ninja@master + + # Qt installation + - if: "!contains(matrix.os, 'windows')" + name: install Qt + uses: jurplel/install-qt-action@v3 + with: + version: '6.5.0' + modules: 'qtcharts' + install-deps: false + + - if: contains( matrix.os, 'windows') + name: install Qt (Windows) + uses: jurplel/install-qt-action@v3 + with: + version: '6.5.0' + modules: 'qtcharts' + install-deps: false + arch: win64_msvc2019_64 + + # Build VSRTL + - if: "!contains(matrix.os, 'windows')" + name: build VSRTL + run: | + cmake \ + -DVSRTL_BUILD_TESTS=ON \ + -DVSRTL_BUILD_APP=ON \ + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ + . + make -j $(nproc) + + - if: contains(matrix.os, 'windows') + name: build Ripes (Windows) + shell: bash + run: | + cmake -GNinja \ + -DVSRTL_BUILD_TESTS=ON \ + -DVSRTL_BUILD_APP=ON \ + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ + -DCMAKE_C_COMPILER=cl \ + -DCMAKE_CXX_COMPILER=cl + cmake --build . + + # Go test + - name: Execute tests + shell: bash + run: | + bash .github/workflows/scripts/run_tests.sh diff --git a/ci_scripts/run_qtests.sh b/.github/workflows/scripts/run_tests.sh similarity index 100% rename from ci_scripts/run_qtests.sh rename to .github/workflows/scripts/run_tests.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b74ca0f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,80 +0,0 @@ - -cache: - apt: true - -matrix: - include: - - os: windows - language: cpp - env: - - VSRTL_PLATFORM: 'windows' - - - env: VSRTL_PLATFORM='mac' - os: osx - osx_image: xcode10 - language: c++ - - # Trustry release build - - env: VSRTL_PLATFORM='linux' CXX=g++-7 CC=gcc-7 - os: linux - dist: trusty - addons: - apt: - sources: # An anchor is not present here given that Travis doesn't parse anchors with sourceline/key_url pairs correctly - - sourceline: 'ppa:beineri/opt-qt-5.10.1-trusty' - key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x10C56D0DE9977759' - - ubuntu-toolchain-r-test - - llvm-toolchain-precise - packages: &packages - - g++-7 - - qt510-meta-minimal - - qt510svg - - # Xenial release build - - env: VSRTL_PLATFORM='linux' CXX=g++-7 CC=gcc-7 - os: linux - dist: xenial - addons: - apt: - sources: - - sourceline: 'ppa:beineri/opt-qt-5.10.1-xenial' - key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x10C56D0DE9977759' - - ubuntu-toolchain-r-test - - llvm-toolchain-precise - packages: - - *packages - - mesa-common-dev - - # Bionic unit test build - - env: VSRTL_PLATFORM='linux_test' CXX=g++-7 CC=gcc-7 - os: linux - dist: bionic - addons: - apt: - sources: - - sourceline: 'ppa:beineri/opt-qt-5.12.0-bionic' - key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x10C56D0DE9977759' - - ubuntu-toolchain-r-test - - llvm-toolchain-precise - packages: - - gcc-7-riscv64-linux-gnu # RV32I unit tests - - g++-7 - - qt512-meta-minimal - - qt512svg - - lcov # CodeCov - - mesa-common-dev - - -before_install: - - source ${TRAVIS_BUILD_DIR}/ci_scripts/${VSRTL_PLATFORM}/before_install.sh - -script: - - source ${TRAVIS_BUILD_DIR}/ci_scripts/${VSRTL_PLATFORM}/travisbuild.sh - -after_success: - - source ${TRAVIS_BUILD_DIR}/ci_scripts/${VSRTL_PLATFORM}/after_success.sh - -branches: - except: - - # Do not build tags that we create when we upload to GitHub Releases - - /^(?i:continuous)/ \ No newline at end of file diff --git a/ci_scripts/linux/after_success.sh b/ci_scripts/linux/after_success.sh deleted file mode 100644 index fa3bf4e..0000000 --- a/ci_scripts/linux/after_success.sh +++ /dev/null @@ -1 +0,0 @@ -# /bin/sh \ No newline at end of file diff --git a/ci_scripts/linux/before_install.sh b/ci_scripts/linux/before_install.sh deleted file mode 100644 index b3b356a..0000000 --- a/ci_scripts/linux/before_install.sh +++ /dev/null @@ -1,5 +0,0 @@ -git fetch --unshallow -git pull --tags -git describe - -source /opt/qt*/bin/qt*-env.sh diff --git a/ci_scripts/linux/travisbuild.sh b/ci_scripts/linux/travisbuild.sh deleted file mode 100644 index febc747..0000000 --- a/ci_scripts/linux/travisbuild.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -ls -cmake -DVSRTL_BUILD_APP=ON \ - -DVSRTL_BUILD_TESTS=ON \ - . -cmake --build . -- -j $(nproc) \ No newline at end of file diff --git a/ci_scripts/linux_test/after_success.sh b/ci_scripts/linux_test/after_success.sh deleted file mode 100644 index edb0130..0000000 --- a/ci_scripts/linux_test/after_success.sh +++ /dev/null @@ -1,21 +0,0 @@ -# /bin/sh - -# Fail on failing QTest execution -set -e - -# Execute unit tests -find . -executable -type f -name "tst_*" | while read line; do - ($line) -done - -# Create lcov report -# capture coverage info -lcov --directory . --capture --output-file coverage.info -# filter out system and extra files. -# To also not include test code in coverage add them with full path to the patterns: '*/tests/*' -lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' --output-file coverage.info -# output coverage data for debugging (optional) -lcov --list coverage.info -# Uploading to CodeCov -# '-f' specifies file(s) to use and disables manual coverage gathering and file search which has already been done above -bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports" diff --git a/ci_scripts/linux_test/before_install.sh b/ci_scripts/linux_test/before_install.sh deleted file mode 100644 index a4f0f4f..0000000 --- a/ci_scripts/linux_test/before_install.sh +++ /dev/null @@ -1,10 +0,0 @@ -# export CC=gcc-6 -# export CXX=g++-6 - -git fetch --unshallow -git pull --tags -git describe - -pip install --user cpp-coveralls - -source /opt/qt*/bin/qt*-env.sh \ No newline at end of file diff --git a/ci_scripts/linux_test/travisbuild.sh b/ci_scripts/linux_test/travisbuild.sh deleted file mode 100644 index c58dd43..0000000 --- a/ci_scripts/linux_test/travisbuild.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -ls -cmake -DVSRTL_BUILD_APP=ON \ - -DVSRTL_BUILD_TESTS=ON \ - -DVSRTL_ENABLE_RISCV_TESTS=ON \ - -DVSRTL_COVERAGE=ON \ - -DCMAKE_BUILD_TYPE=Debug \ - . -cmake --build . --config Debug -- -j $(nproc) \ No newline at end of file diff --git a/ci_scripts/mac/after_success.sh b/ci_scripts/mac/after_success.sh deleted file mode 100644 index e69de29..0000000 diff --git a/ci_scripts/mac/before_install.sh b/ci_scripts/mac/before_install.sh deleted file mode 100644 index 29a1be6..0000000 --- a/ci_scripts/mac/before_install.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Adapted from https://github.com/Subsurface-divelog/subsurface/blob/master/scripts/mac/before_install.sh - -set -x - -# try to get rid of the insane debug crap -unalias -a -unset -f rvm_debug -unset -f cd -unset -f pushd -unset -f popd - -# Travis only pulls shallow repos. But that messes with git describe. -# Sorry Travis, fetching the whole thing and the tags as well... -git fetch --unshallow -git pull --tags -git describe - -# prep things so we can build for Mac -# we have a custom built Qt some gives us just what we need -# we should just build and install this into /usr/local/ as well and have -# it all be part of the cache... - -pushd ${TRAVIS_BUILD_DIR} - -mkdir -p Qt/5.13.0 -curl --output Qt-5.13.0-mac.tar.xz https://f002.backblazeb2.com/file/Subsurface-Travis/Qt-5.13.0-mac.tar.xz -tar -xJ -C Qt/5.13.0 -f Qt-5.13.0-mac.tar.xz diff --git a/ci_scripts/mac/travisbuild.sh b/ci_scripts/mac/travisbuild.sh deleted file mode 100644 index 5114558..0000000 --- a/ci_scripts/mac/travisbuild.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -x -set -e - -# this gets executed by Travis when building an App for Mac -# it gets started from inside the subsurface directory - -export QT_ROOT=${TRAVIS_BUILD_DIR}/Qt/5.13.0/clang_64 -export PATH=$QT_ROOT/bin:$PATH # Make sure correct qmake is found on the $PATH -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH - -ls -cmake . -make -j$(nproc) diff --git a/ci_scripts/windows/after_success.sh b/ci_scripts/windows/after_success.sh deleted file mode 100644 index a9bf588..0000000 --- a/ci_scripts/windows/after_success.sh +++ /dev/null @@ -1 +0,0 @@ -#!/bin/bash diff --git a/ci_scripts/windows/before_install.sh b/ci_scripts/windows/before_install.sh deleted file mode 100644 index 458b156..0000000 --- a/ci_scripts/windows/before_install.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -export QT_VERSION=5.13.1 -export QT_PREFIX=msvc2017_64 -export QT_TOOLCHAIN=win64_${QT_PREFIX} -export CMAKE_GENERATOR="Visual Studio 15 2017 Win64" - -# Fetch and install Qt using the qbs non-interactive qt installer script -curl -vLO https://code.qt.io/cgit/qbs/qbs.git/plain/scripts/install-qt.sh -bash install-qt.sh \ - --version ${QT_VERSION} \ - --toolchain ${QT_TOOLCHAIN}\ - qtbase qttools svg - -choco install zip diff --git a/ci_scripts/windows/travisbuild.sh b/ci_scripts/windows/travisbuild.sh deleted file mode 100644 index e085653..0000000 --- a/ci_scripts/windows/travisbuild.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -set -e - -export CMAKE_PREFIX_PATH=/c/Qt/${QT_VERSION}/${QT_PREFIX}:${CMAKE_PREFIX_PATH} -export PATH=/c/Qt/${QT_VERSION}/${QT_PREFIX}/bin:${PATH} - -cmake . -G "${CMAKE_GENERATOR}" - -find /c/Qt/${QT_VERSION}/${QT_PREFIX}/bin - -cmake --build . \ - -j$(nproc) \ - --config Release