From f26070ef4f455f40df129cdb9cae11c1dcb3198f Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 27 Aug 2021 16:50:46 +0200 Subject: [PATCH] Switch from Travis-CI to Github Actions --- .github/workflows/build.yml | 51 +++++++++++++++++++++++++++++++++++++ .travis.yml | 22 ---------------- README.rst | 8 +++--- util/ci/script.sh | 15 +++++++++++ util/travis/script.sh | 8 ------ 5 files changed, 70 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml create mode 100755 util/ci/script.sh delete mode 100755 util/travis/script.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1f7eab1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,51 @@ +name: build + +# build on c/cpp changes or workflow changes +on: + push: + paths: + - '**.[ch]' + - '**.cpp' + - '**/CMakeLists.txt' + - '.github/workflows/**.yml' + pull_request: + paths: + - '**.[ch]' + - '**.cpp' + - '**/CMakeLists.txt' + - '.github/workflows/**.yml' + +jobs: + gcc: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install deps + run: | + source util/ci/script.sh + install_linux_deps + + - name: Build + run: | + source util/ci/script.sh + run_build + env: + CC: gcc + CXX: g++ + + clang: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install deps + run: | + source util/ci/script.sh + install_linux_deps + + - name: Build + run: | + source util/ci/script.sh + run_build + env: + CC: clang + CXX: clang++ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 08c7f8f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -arch: - - amd64 - - ppc64le -language: cpp -compiler: - - gcc - - clang -dist: bionic -addons: - apt: - packages: - - cmake - - libgd-dev - - libsqlite3-dev - - libleveldb-dev - - libpq-dev - - postgresql-server-dev-all -script: ./util/travis/script.sh -notifications: - email: false -matrix: - fast_finish: true diff --git a/README.rst b/README.rst index 6845efe..08d7d30 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,13 @@ Minetest Mapper C++ =================== -.. image:: https://travis-ci.org/minetest/minetestmapper.svg?branch=master - :target: https://travis-ci.org/minetest/minetestmapper +.. image:: https://github.com/minetest/minetestmapper/workflows/build/badge.svg + :target: https://github.com/minetest/minetestmapper/actions/workflows/build.yml Minetestmapper generates an overview image from a Minetest map. -A port of minetestmapper.py to C++ from https://github.com/minetest/minetest/tree/master/util. -This version is both faster and provides more features than the now deprecated Python script. +A port of minetestmapper.py to C++ from https://github.com/minetest/minetest/tree/0.4.17/util. +This version is both faster and provides more features than the now obsolete Python script. Requirements ------------ diff --git a/util/ci/script.sh b/util/ci/script.sh new file mode 100755 index 0000000..c27c98f --- /dev/null +++ b/util/ci/script.sh @@ -0,0 +1,15 @@ +#!/bin/bash -e + +install_linux_deps() { + local pkgs=(cmake libgd-dev libsqlite3-dev libleveldb-dev libpq-dev libhiredis-dev) + + sudo apt-get update + sudo apt-get install -y --no-install-recommends ${pkgs[@]} "$@" +} + +run_build() { + cmake . -DCMAKE_BUILD_TYPE=Debug \ + -DENABLE_LEVELDB=1 -DENABLE_POSTGRESQL=1 -DENABLE_REDIS=1 + + make -j2 +} diff --git a/util/travis/script.sh b/util/travis/script.sh deleted file mode 100755 index f1227b2..0000000 --- a/util/travis/script.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -e -mkdir -p travisbuild -cd travisbuild - -cmake .. \ - -DENABLE_LEVELDB=1 - -make -j2