From 43169ecf867ebb54c0ad20d62df6248e4273eacc Mon Sep 17 00:00:00 2001 From: Adrien Bertrand Date: Sun, 15 Jan 2023 00:24:01 +0100 Subject: [PATCH] replace Travis CI by GitHub Actions CI Only using cmake+ninja, for now --- .github/workflows/build.linux.workflow.yml | 69 +++++++++++++++++++++ .github/workflows/build.mac.workflow.yml | 70 ++++++++++++++++++++++ .travis.yml | 67 --------------------- .travis/script.sh | 59 ------------------ 4 files changed, 139 insertions(+), 126 deletions(-) create mode 100644 .github/workflows/build.linux.workflow.yml create mode 100644 .github/workflows/build.mac.workflow.yml delete mode 100644 .travis.yml delete mode 100755 .travis/script.sh diff --git a/.github/workflows/build.linux.workflow.yml b/.github/workflows/build.linux.workflow.yml new file mode 100644 index 000000000..153b75308 --- /dev/null +++ b/.github/workflows/build.linux.workflow.yml @@ -0,0 +1,69 @@ +name: Build Linux + +on: + push: + branches: [ master, feature/github-actions ] + pull_request: + branches: [ master, feature/github-actions ] + release: + types: [published] + +jobs: + build: + name: "Build: ${{ matrix.os }} - ${{ matrix.deps_type }} deps" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + try_static_deps: ['OFF','ON'] + include: + - try_static_deps: 'OFF' + deps_type: shared + - try_static_deps: 'ON' + deps_type: static + + steps: + - name: Checkout Git Repo + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: workaround for default apt mirror connectivity issues + run: | + sudo sed -i 's/azure\.//' /etc/apt/sources.list + + - name: Install dependencies + run: | + set -e + sudo add-apt-repository universe + sudo apt update + sudo apt install -y cmake ninja-build libarchive-dev libzstd-dev zlib1g-dev libusb-1.0-0-dev libglib2.0-dev gettext nettle-dev libacl1-dev liblzma-dev liblz4-dev libudev-dev libc6-dev + + - name: Build tilibs + run: | + set -e + mkdir prefix + prefixpath="$(pwd)/prefix" + mkdir build && cd build + cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DTRY_STATIC_LIBS=${{ matrix.try_static_deps }} -DCMAKE_INSTALL_PREFIX=${prefixpath} .. + cmake --build . --target all + + - name: Test tilibs + run: | + cd build + cmake --build . --target check + + - name: Install tilibs + run: | + cd build + cmake --build . --target install + + - name: Prepare install folder for upload + run: mv prefix tilibs_linux_${{ matrix.deps_type }}Deps_${{ github.sha }} + + - name: Upload install folder + uses: actions/upload-artifact@v3 + with: + name: tilibs_linux_${{ matrix.deps_type }}Deps_${{ github.sha }} + path: tilibs_linux_${{ matrix.deps_type }}Deps_${{ github.sha }}/ \ No newline at end of file diff --git a/.github/workflows/build.mac.workflow.yml b/.github/workflows/build.mac.workflow.yml new file mode 100644 index 000000000..0ce85c0e0 --- /dev/null +++ b/.github/workflows/build.mac.workflow.yml @@ -0,0 +1,70 @@ +name: Build macOS + +on: + push: + branches: [ master, feature/github-actions ] + pull_request: + branches: [ master, feature/github-actions ] + release: + types: [published] + +jobs: + build: + name: "Build: ${{ matrix.os }} - ${{ matrix.deps_type }} deps" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macOS-latest] + try_static_deps: ['OFF','ON'] + include: + - try_static_deps: 'OFF' + deps_type: shared + - try_static_deps: 'ON' + deps_type: static + + steps: + - name: Checkout Git Repo + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Install dependencies + run: | + set -e + brew install cmake ninja gettext libarchive glib libusb libiconv intltool expat bzip2 zlib + + # Workaround! + # libarchive.pc now has (lib)iconv in Requires.private, which doesn't work here + # See https://github.com/libarchive/libarchive/pull/1813 and other issues + - name: Fix libarchive pkg-config file + run: | + sudo sed -i '' -E '/^Requires.private: (lib)?iconv/d' /usr/local/opt/libarchive/lib/pkgconfig/libarchive.pc + + - name: Build tilibs + run: | + set -e + mkdir prefix + prefixpath="$(pwd)/prefix" + mkdir build && cd build + cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DTRY_STATIC_LIBS=${{ matrix.try_static_deps }} -DCMAKE_INSTALL_PREFIX=${prefixpath} .. + cmake --build . --target all + + - name: Test tilibs + run: | + cd build + cmake --build . --target check + + - name: Install tilibs + run: | + cd build + cmake --build . --target install + + - name: Prepare install folder for upload + run: mv prefix tilibs_mac_${{ matrix.deps_type }}Deps_${{ github.sha }} + + - name: Upload install folder + uses: actions/upload-artifact@v3 + with: + name: tilibs_mac_${{ matrix.deps_type }}Deps_${{ github.sha }} + path: tilibs_mac_${{ matrix.deps_type }}Deps_${{ github.sha }}/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7fcbb9221..000000000 --- a/.travis.yml +++ /dev/null @@ -1,67 +0,0 @@ -language: c - -_linuxpackages: &_linuxpackages - addons: - apt: - packages: - - build-essential - - git - - autoconf - - automake - - autopoint - - libtool - - libglib2.0-dev - - zlib1g-dev - - libusb-1.0-0-dev - - gettext - - bison - - flex - - groff - - texinfo - - libarchive-dev - - ninja-build - - liblz4-dev - - liblzma-dev - -matrix: - include: - - os: linux - arch: amd64 - dist: xenial - env: PREBUILDER=autotools BUILDER=make - <<: *_linuxpackages - - os: linux - arch: amd64 - dist: xenial - env: PREBUILDER=cmake BUILDER=make - <<: *_linuxpackages - - os: linux - arch: amd64 - dist: xenial - env: PREBUILDER=cmake BUILDER=ninja - <<: *_linuxpackages - - os: linux - arch: amd64 - dist: bionic - env: PREBUILDER=cmake BUILDER=ninja - <<: *_linuxpackages - - os: linux - arch: arm64 - dist: bionic - env: PREBUILDER=cmake BUILDER=ninja - <<: *_linuxpackages - - os: osx - env: PREBUILDER=autotools BUILDER=make - - os: osx - env: PREBUILDER=cmake BUILDER=make - - os: osx - env: PREBUILDER=cmake BUILDER=ninja - -install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja gettext libarchive libtool glib libusb bison flex texinfo libiconv intltool ; brew link --force gettext libarchive ; export PKG_CONFIG_PATH="/usr/local/opt/libarchive/lib/pkgconfig"; fi - - which gcc ; gcc --version - - which cmake ; cmake --version - - which ninja ; ninja --version - - which make ; make --version - -script: .travis/script.sh diff --git a/.travis/script.sh b/.travis/script.sh deleted file mode 100755 index 54ae7bbf9..000000000 --- a/.travis/script.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -NPROC=1 -if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - NPROC=$(sysctl -n hw.physicalcpu) -elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - NPROC=$(nproc) -fi - -mkdir prefix -prefixpath="$(pwd)/prefix" -export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${prefixpath}/lib/pkgconfig - -if [ "$PREBUILDER" == "autotools" ]; then - cd libticonv/trunk - mkdir m4; autoreconf -ivf & - cd ../../libtifiles/trunk - mkdir m4; autoreconf -ivf & - cd ../../libticables/trunk - mkdir m4; autoreconf -ivf & - cd ../../libticalcs/trunk - mkdir m4; autoreconf -ivf & - wait - cd ../../libticonv/trunk - ./configure --prefix=${prefixpath} - make -j${NPROC} check - make -j${NPROC} install - cd ../../libtifiles/trunk - cd po; make libtifiles2.pot-update; make update-po; cd .. - ./configure --prefix=${prefixpath} - make -j${NPROC} check - make -j${NPROC} install - cd ../../libticables/trunk - cd po; make libticables2.pot-update; make update-po; cd .. - ./configure --prefix=${prefixpath} --enable-logging --enable-libusb10 - make -j${NPROC} check - make -j${NPROC} install - cd ../../libticalcs/trunk - cd po; make libticalcs2.pot-update; make update-po; cd .. - ./configure --prefix=${prefixpath} - make -j${NPROC} check - make -j${NPROC} install - -elif [ "$PREBUILDER" == "cmake" ]; then - mkdir build && cd build - if [ "$BUILDER" == "ninja" ]; then - GPARAM="-GNinja" - elif [ "$BUILDER" != "make" ]; then - echo "Unsupported builder: ${BUILDER}" - exit -1 - fi - cmake ${GPARAM} -DCMAKE_INSTALL_PREFIX=${prefixpath} .. - cmake --build . --target all - cmake --build . --target check - cmake --build . --target install -else - echo "Unsupported prebuilder: ${PREBUILDER}" - exit -1 -fi