From 5ed8e7e16664de00a44ccf24b1a6c29d2baa7dae Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Mon, 19 Jun 2023 15:23:55 +0200 Subject: [PATCH] Use GH actions for CI builds Signed-off-by: Steffen Jaeckel --- .github/workflows/deploy.yml | 47 +++++++++++++ .github/workflows/main.yml | 131 +++++++++++++++++++++++++++++++++++ .travis.yml | 40 ----------- 3 files changed, 178 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..b8fd226 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,47 @@ +############################################################################# +# # +# Packagecloud deployment via GH actions for TomsFastMath # +# (https://github.com/libtom/tomsfastmath.git) # +# # +############################################################################# + +name: Deploy + +on: + workflow_dispatch + +jobs: + deploy-to-packagecloud: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-20.04, ubuntu-22.04 ] + steps: + - uses: actions/checkout@v2 + - name: set Ubuntu codename + run: | + echo "ubuntu_codename="$(lsb_release -sc) >> "$GITHUB_ENV" + - name: install dependencies + run: | + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null + echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${{ env.ubuntu_codename }} main" | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null + sudo apt-get update -qq + sudo apt-get install -y cmake gcc + - name: build packages + run: | + mkdir -p build + cd build + cmake -DBUILD_SHARED_LIBS=Off -DCMAKE_BUILD_TYPE=RelWithDebInfo .. + make -j$(nproc) + cpack -G DEB + cmake -DBUILD_SHARED_LIBS=On -DCMAKE_BUILD_TYPE=RelWithDebInfo .. + make -j$(nproc) + cpack -G DEB + - name: push deb packages to packagecloud.io + uses: computology/packagecloud-github-action@v0.6 + with: + PACKAGE-NAME: build/packages/ubuntu/${{ env.ubuntu_codename }}/*.deb + PACKAGECLOUD-USERNAME: libtom + PACKAGECLOUD-REPONAME: packages + PACKAGECLOUD-DISTRO: ubuntu/${{ env.ubuntu_codename }} + PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..7569652 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,131 @@ +############################################################################# +# # +# GitHub Actions test-suite for TomsFastMath # +# (https://github.com/libtom/tomsfastmath.git) # +# # +############################################################################# + +name: CI + +# Tests restricted to the following branches. +on: + push: + branches: + - master + - develop + - /^release\/.*$/ + - /^support\/.*$/ + - /^ci\/.*$/ + pull_request: + branches: + - master + - develop + - /^release\/.*$/ + - /^support\/.*$/ + - /^ci\/.*$/ + +jobs: + Testme: + runs-on: ${{ matrix.os }} + strategy: + max-parallel: 1 + matrix: + os: [ ubuntu-20.04 ] + # The environment given to the programs in the build + # We have only one program and the variable $BUILDOPTIONS + # has only the options to that program: testme.sh + + config: + # GCC for the x86-64 architecture (64-bit longs and 64-bit pointers) + - { CC: 'gcc', DEPS: 'gcc' } + - { CC: 'gcc-10', DEPS: 'gcc-10' } + - { CC: 'gcc-8', DEPS: 'gcc-8' } + - { CC: 'gcc-7', DEPS: 'gcc-7' } + + # clang for x86-64 architecture (64-bit longs and 64-bit pointers) + - { CC: 'clang', DEPS: 'clang' } + - { CC: 'clang-10', DEPS: 'clang-10 llvm-10' } + - { CC: 'clang-12', DEPS: 'clang-12 llvm-12' } + - { CC: 'clang-9', DEPS: 'clang-9 llvm-9' } + - { CC: 'clang-8', DEPS: 'clang-8 llvm-8' } + - { CC: 'clang-7', DEPS: 'clang-7 llvm-7' } + - { CC: 'clang-6.0', DEPS: 'clang-6.0 llvm-6.0' } + + makefile: [ makefile, makefile.shared ] + steps: + - uses: actions/checkout@v2 + - name: install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install libtool-bin -y ${{ matrix.config.DEPS }} + sudo apt-cache search gcc | grep '^gcc-[0-9\.]* ' + sudo apt-cache search clang | grep compiler + - name: run tests + env: + CC: ${{ matrix.config.CC }} + run: | + $CC -dumpversion + make -f ${{ matrix.makefile }} test_standalone >gcc_errors_1.log 2>gcc_errors_2.log + ./test >test_std.log 2>test_err.log + # In case of a CI error a success might get signaled + # even without any test run. This file also keeps any notes + # printed from the tests which might come handy from time + # to time. + - name: regular logs + if: ${{ !failure() }} + run: | + cat test_*.log || true + # Compilation failures are in gcc_errors_*.log + # Failed tests in test_*.log + # Files do not exist in case of success + - name: error logs + if: ${{ failure() }} + run: | + cat test_*.log || true + cat gcc_errors_*.log || true + + amalgam: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: build stest with amalgamated sources + run: | + make amalgamated_stest + + CMake: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-20.04, ubuntu-22.04 ] + build_type: [ '', -DCMAKE_BUILD_TYPE=Debug, -DCMAKE_BUILD_TYPE=Release, -DCMAKE_BUILD_TYPE=RelWithDebInfo, -DCMAKE_BUILD_TYPE=MinSizeRel ] + cc: [ clang, gcc ] + config: + # Static library build + - { CMAKEOPTIONS: '-DBUILD_SHARED_LIBS=Off' } + # Shared library build + - { CMAKEOPTIONS: '-DBUILD_SHARED_LIBS=On' } + steps: + - uses: actions/checkout@v2 + - name: install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y cmake gcc clang llvm + - name: build + run: | + mkdir build + cd build + CC=${{ matrix.cc }} cmake ${{ matrix.config.CMAKEOPTIONS }} ${{ matrix.build_type }} .. + make -j$(nproc) + - name: test + run: | + cd build + CC=${{ matrix.cc }} cmake ${{ matrix.config.CMAKEOPTIONS }} ${{ matrix.build_type }} -DBUILD_TESTING=On .. + make -j$(nproc) + ctest + - name: test (in demo folder) + run: | + mkdir -p demo/build + cd demo/build + CC=${{ matrix.cc }} cmake ${{ matrix.config.CMAKEOPTIONS }} ${{ matrix.build_type }} .. + make -j$(nproc) + ctest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fc2277a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -dist: trusty -sudo: required -language: c -compiler: - - gcc -branches: - only: - - master - - develop - - /^release/ - - /^travis/ -script: CC="${MYCC}" make ${SHARED} test_standalone >test_gcc_1.txt 2>test_gcc_2.txt && ./test >test_std.txt 2>test_err.txt -env: - - MYCC="gcc" SHARED="" - - MYCC="gcc -m32" SHARED="" - - MYCC="gcc-4.8" SHARED="" - - MYCC="gcc-4.8 -m32" SHARED="" - - MYCC="gcc-4.9" SHARED="" - - MYCC="gcc-4.9 -m32" SHARED="" - - MYCC="gcc" SHARED="-f makefile.shared" - - MYCC="gcc -m32" SHARED="-f makefile.shared" - - MYCC="gcc-4.8" SHARED="-f makefile.shared" - - MYCC="gcc-4.8 -m32" SHARED="-f makefile.shared" - - MYCC="gcc-4.9" SHARED="-f makefile.shared" - - MYCC="gcc-4.9 -m32" SHARED="-f makefile.shared" -matrix: - fast_finish: true -before_script: - - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - - sudo apt-get -qq update - - sudo apt-get install gcc-4.9-multilib gcc-4.8-multilib gcc-multilib build-essential -after_failure: - - cat test_gcc_1.txt - - cat test_std.txt - - cat test_err.txt -after_script: - - cat test_gcc_2.txt -notifications: - irc: "chat.freenode.net#libtom-notifications" -