From 2e60e2163b71e7d210d7f36616dbd05fbab2c096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Wed, 26 Jan 2022 23:12:50 +0100 Subject: [PATCH] Migrate from Travis CI to Github Actions --- .github/workflows/build.yml | 175 ++++++++++++++++++++++++++++++++++++ .travis.yml | 99 -------------------- 2 files changed, 175 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..ec1f55e8c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,175 @@ +# +# Copyright: 2022, The Geany contributors +# License: GNU GPL v2 or later + +name: CI Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +# cancel already running builds of the same branch or pull request +concurrency: + group: ci-${{ github.head_ref }} || concat(${{ github.ref }} + cancel-in-progress: true + +env: + CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration + CONFIGURE_FLAGS: --disable-silent-rules + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_COMPRESS: true + CCACHE_MAXSIZE: 1G + PYTHON: python3 + JOBS: 2 + DEBUG: 0 + +jobs: + linux: + name: Linux Build + runs-on: ubuntu-18.04 + + env: + CC: ccache gcc + CXX: ccache g++ + GEANY_SOURCE_PATH: ${{ github.workspace }}/.geany_source + GEANY_CACHE_PATH: ${{ github.workspace }}/.geany_cache + GEANY_INSTALLATION_PATH: ${{ github.workspace }}/.geany_cache/_geany_install + PKG_CONFIG_PATH: ${{ github.workspace }}/.geany_cache/_geany_install/lib/pkgconfig:$PKG_CONFIG_PATH + LD_LIBRARY_PATH: ${{ github.workspace }}/.geany_cache/_geany_install/lib:$LD_LIBRARY_PATH + + steps: + - name: Checkout Geany-Plugins + uses: actions/checkout@v2 + + - name: Checkout Geany + uses: actions/checkout@v2 + with: + repository: geany/geany + path: ${{ env.GEANY_SOURCE_PATH }} + token: ${{ github.token }} + + # create and use a timestamp for the cache key: GH Actions will never update a cache + # only use an existing cache item or create a new one. To use an existing cache *and* + # push back the the updated cache after build, we use a always new cache key (to force + # the creation of the cache item at the end) in combination with "restore-keys" as fallback + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M)" + + - name: Configure ccache + uses: actions/cache@v2 + with: + path: ${{ env.CCACHE_DIR }} + key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: ${{ runner.os }}-${{ github.job }}-ccache- + + - name: Prepare Geany Cache Key + id: prepare_geany_cache_key + working-directory: ${{ env.GEANY_SOURCE_PATH }} + run: echo "::set-output name=commit_hash::$(git rev-parse HEAD)" + + - name: Configure Geany Cache + id: geany_cache + uses: actions/cache@v2 + with: + path: ${{ env.GEANY_CACHE_PATH }} + key: ${{ runner.os }}-${{ github.job }}-geany-cache-${{ steps.prepare_geany_cache_key.outputs.commit_hash }} + + - name: Show environment + if: ${{ env.DEBUG == '1' }} + run: | + env | sort + + - name: Install Dependencies + run: | + sudo apt-get update --quiet --quiet + # write dependencies to a temporary file which is then fed to "apt-get install", + # so we can use comments in the dependency list + cat << EOF > $RUNNER_TEMP/dependencies + # general + ccache + libtool + libgtk-3-dev + # geany + autopoint + gettext + python-docutils + # geany-plugins + intltool + check + cppcheck + # debugger + libvte-2.91-dev + # devhelp + libwebkitgtk-dev + libwnck-dev + libgconf2-dev + zlib1g-dev + # geanygendoc + libctpl-dev + # geanylua + liblua5.1-0-dev + # geanypg + libgpgme-dev + # geanypy + python-dev + # geanyvc + libgtkspell-dev + libgtkspell3-3-dev + # geaniuspaste/updatechecker + libsoup2.4-dev + # git-changebar + libgit2-dev + # markdown + libmarkdown2-dev + # markdown/webhelper + libwebkitgtk-3.0-dev + # multiterm + valac + # pretty-printer + libxml2-dev + # spellcheck + libenchant-dev + EOF + grep -v '^[ ]*#' $RUNNER_TEMP/dependencies | xargs sudo apt-get install --assume-yes --no-install-recommends + + - name: Build Geany + if: steps.geany_cache.outputs.cache-hit != 'true' + run: | + cd "${{ env.GEANY_SOURCE_PATH }}" + NOCONFIGURE=1 ./autogen.sh + mkdir _build + cd _build + { ../configure --prefix="${{ env.GEANY_INSTALLATION_PATH }}" || { cat config.log; exit 1; } ; } + make -j ${{ env.JOBS }} + make -j ${{ env.JOBS }} install + + - name: Configure + run: | + NOCONFIGURE=1 ./autogen.sh + mkdir _build + cd _build + { ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; } + + - name: Build + run: | + cd _build + make -j ${{ env.JOBS }} + + - name: Run Tests + run: | + cd _build + make -j ${{ env.JOBS }} check + + - name: Run distcheck + run: | + cd _build + make -j ${{ env.JOBS }} distcheck DISTCHECK_CONFIGURE_FLAGS="${{ env.CONFIGURE_FLAGS }}"; + + - name: ccache statistics + if: ${{ env.DEBUG == '1' }} + run: ccache --show-stats diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dd0558020..000000000 --- a/.travis.yml +++ /dev/null @@ -1,99 +0,0 @@ -language: c -dist: bionic -sudo: false - -compiler: - - gcc - -cache: - ccache: true - directories: - - $HOME/geany/gtk3 - -addons: - apt: - packages: - - libgtk-3-dev - - intltool - - libtool - - python-docutils - - check - - cppcheck - # geany - - gettext autopoint - # debugger - - libvte-2.91-dev - # devhelp - - libwebkitgtk-dev - - libwnck-dev - - libgconf2-dev - - zlib1g-dev - # geanygendoc - - libctpl-dev - # geanylua - - liblua5.1-0-dev - # geanypg - - libgpgme11-dev - # geanypy - - python-dev - # geanyvc - - libgtkspell-dev - - libgtkspell3-3-dev - # geaniuspaste/updatechecker - - libsoup2.4-dev - # git-changebar - - libgit2-dev - # markdown - - libmarkdown2-dev - # markdown/webhelper - - libwebkitgtk-3.0-dev - # multiterm - - valac - # pretty-printer - - libxml2-dev - # spellcheck - - libenchant-dev - -before_install: - # build Geany - - TEMPDIR=$(mktemp -d) - - git clone git://github.com/geany/geany.git "$TEMPDIR/geany" - - geany_commit=$(cd "$TEMPDIR/geany" && git rev-parse HEAD) - - gtkver=gtk3 - - cachedir="$HOME/geany/$gtkver/" - - cache_id=$(cat "$cachedir/commit-id" 2>/dev/null || echo "none") - # check if the cache is up-to-date, and either use it, or (re-)create it - - > - if test "$geany_commit" = "$cache_id"; then - echo "Cache '$cachedir' looks good, using it (ID: $cache_id)."; - else - echo "Cache '$cachedir' is missing, outdated or invalid, dropping it."; - echo " Cache ID: $cache_id"; - echo " Geany ID: $geany_commit"; - rm "$cachedir" -rf || exit 1; - ( cd "$TEMPDIR/geany" && - NOCONFIGURE=1 ./autogen.sh && - ./configure --prefix="$cachedir" && - make -j2 && - make install || exit 1; - git rev-parse HEAD > "$cachedir/commit-id" || exit 2; - ) || exit $?; - fi - - test -z "$TEMPDIR" || rm -rf "$TEMPDIR" - - export PKG_CONFIG_PATH="$cachedir/lib/pkgconfig:$PKG_CONFIG_PATH" - - export LD_LIBRARY_PATH="$cachedir/lib:$LD_LIBRARY_PATH" - -before_script: - # prepare for GP - - export CFLAGS="-g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration" - -script: - - NOCONFIGURE=1 ./autogen.sh - - mkdir _build && cd _build - - ../configure --disable-silent-rules - - make -j2 - - make -j2 check - - make -j2 distcheck - -after_script: - - test -z "$TEMPDIR" || rm -rf "$TEMPDIR"