diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 000000000..2b8813738 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,79 @@ +name: Build and Test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + # Allow to run manually + workflow_dispatch: + +env: + BUILD_TYPE: Release + XDG_RUNTIME_DIR: /tmp/openrw-runtimedir + ALSOFT_DRIVERS: "null" + +jobs: + archlinux: + name: Arch Linux + runs-on: ubuntu-latest + container: + image: docker.io/archlinux/archlinux:latest + steps: + - name: Install dependencies + run: | + pacman -Syy --noconfirm --disable-sandbox \ + git core/gcc extra/llvm extra/clang make ninja curl \ + extra/boost extra/cmake extra/ffmpeg extra/bullet extra/glm \ + extra/openal extra/sdl2 extra/qt5-base extra/freetype2 + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Make runtime directory + run: mkdir -p ${XDG_RUNTIME_DIR} + - name: Build and test + run: mkdir build && cd build && ctest -VV -S ../cmake/ctest/script_ci.ctest + fedora: + name: Fedora + runs-on: ubuntu-latest + container: + image: quay.io/fedora/fedora:latest + steps: + - name: Install dependencies + run: | + dnf install -y git-core boost-devel gcc gcc-c++ clang llvm lcov curl \ + boost-devel cmake make ninja-build bullet-devel ffmpeg-free-devel \ + glm-devel openal-soft-devel SDL2-devel qt5-qtbase-devel \ + freetype-devel libasan + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Make runtime directory + run: mkdir -p ${XDG_RUNTIME_DIR} + - name: Build and test + run: mkdir build && cd build && ctest -VV -S ../cmake/ctest/script_ci.ctest + ubuntu: + name: Ubuntu + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get update && \ + sudo apt-get install --no-install-recommends --no-upgrade -y \ + git-core build-essential cmake ninja-build clang llvm lcov curl \ + libavcodec-dev libavformat-dev libboost-program-options-dev \ + libboost-system-dev libbullet-dev libglm-dev libopenal-dev \ + libsdl2-dev libboost-test-dev libqt5opengl5-dev libfreetype6-dev \ + iwyu qtbase5-dev qt5-qmake + env: + DEBIAN_FRONTEND: noninteractive + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Make runtime directory + run: mkdir -p ${XDG_RUNTIME_DIR} + - name: Build and test + run: mkdir build && cd build && ctest -VV -S ../cmake/ctest/script_ci.ctest \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e92448350..000000000 --- a/.travis.yml +++ /dev/null @@ -1,62 +0,0 @@ -language: cpp - -matrix: - include: - - os: linux - compiler: gcc - env: NAME="Ubuntu Linux (Latest)" NAME_SUFFIX="ubuntu" TEST_COVERAGE=1 - services: docker - script: - - scripts/docker/docker_travis.sh "ubuntu_latest.docker" - - os: linux - compiler: clang - env: NAME="Fedora Linux (Latest)" NAME_SUFFIX="fedora-llvm" - services: docker - script: - - scripts/docker/docker_travis.sh "fedora_latest.docker" - - os: linux - compiler: gcc - env: NAME="Arch Linux (Latest)" NAME_SUFFIX="arch" DEBUG=1 - services: docker - script: - - scripts/docker/docker_travis.sh "arch_latest.docker" - # - os: linux - # compiler: gcc - # env: NAME="conan" NAME_SUFFIX="conan" USE_CONAN=1 - # script: - # - scripts/docker/docker_travis.sh "conan_base.docker" - - os: osx - compiler: clang - env: NAME="Apple macOS" NAME_SUFFIX="mac" - osx_image: xcode12.5 - cache: - directories: - - $HOME/Library/Caches/Homebrew - before_cache: - - brew cleanup - addons: - homebrew: - packages: - - boost - - cmake - - bullet - - ffmpeg - - glm - - openal-soft - - qt5 - - sdl2 - - jack - - freetype - install: - - export PATH="/usr/local/opt/qt/bin:$PATH" - script: - - mkdir -p "$TRAVIS_BUILD_DIR/build" - - ctest -VV -S "$TRAVIS_BUILD_DIR/cmake/ctest/script_ci.ctest" - -notifications: - email: false -# irc: -# channels: -# - chat.freenode.net#openrw -# template: -# - "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}" diff --git a/cmake/ctest/utils.ctest b/cmake/ctest/utils.ctest index 814007a81..889782272 100644 --- a/cmake/ctest/utils.ctest +++ b/cmake/ctest/utils.ctest @@ -74,14 +74,15 @@ function(openrw_build_name BUILDER_NAME_RES BUILD_NAME_RES) endif() if(MODEL_NAME STREQUAL "continuous") - if("$ENV{TRAVIS}") - message(STATUS "Travis detected") - set(BUILDER_NAME "Travis") - set(REPO_NAME "$ENV{TRAVIS_REPO_SLUG}") - set(REPO_BRANCH "$ENV{TRAVIS_BRANCH}") - set(GIT_HASH "$ENV{TRAVIS_COMMIT}") - set(_EVENT_TYPE "$ENV{TRAVIS_EVENT_TYPE}") - set(SUBMIT TRUE) + if("$ENV{GITHUB_ACTIONS}") + message(STATUS "GitHub Actions detected") + set(BUILDER_NAME "GitHub Actions") + set(REPO_NAME "$ENV{GITHUB_REPOSITORY}") + set(REPO_BRANCH "$ENV{GITHUB_REF}") + set(GIT_HASH "$ENV{GITHUB_SHA}") + set(_EVENT_TYPE "$ENV{GITHUB_EVENT_NAME}") + # FIXME: enable submit + set(SUBMIT FALSE) elseif("$ENV{APPVEYOR}") message(STATUS "AppVeyor detected") set(BUILDER_NAME "AppVeyor") diff --git a/cmake_configure.cmake b/cmake_configure.cmake index 8d0db9d4f..9a6533f1e 100644 --- a/cmake_configure.cmake +++ b/cmake_configure.cmake @@ -144,9 +144,9 @@ if(TEST_COVERAGE) if(_RE_REFSPEC) set(GIT_BRANCH "${CMAKE_MATCH_1}") message(STATUS "Git branch detected from .git directory: ${GIT_BRANCH}") - elseif(DEFINED ENV{TRAVIS_BRANCH}) - set(GIT_BRANCH "$ENV{TRAVIS_BRANCH}") - message(STATUS "Git branch detected from TRAVIS_BRANCH environment variable: ${GIT_BRANCH}") + elseif(DEFINED ENV{GITHUB_REF}) + set(GIT_BRANCH "$ENV{GITHUB_REF}") + message(STATUS "Git branch detected from GITHUB_BRANCH environment variable: ${GIT_BRANCH}") else() message("Git branch unknown: uploading coverage might nog work") endif() diff --git a/scripts/docker/arch_latest.docker b/scripts/docker/arch_latest.docker deleted file mode 100644 index 4bcf402dc..000000000 --- a/scripts/docker/arch_latest.docker +++ /dev/null @@ -1,30 +0,0 @@ -FROM archlinux:base - -# Work-around the issue with glibc 2.33 on old Docker engines -# Extract files directly as pacman is also affected by the issue -# https://github.com/lxqt/lxqt-panel/pull/1562 and -# https://github.com/actions/virtual-environments/issues/2658 -RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \ - curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && \ - bsdtar -C / -xf $patched_glibc - -RUN pacman -Syy --noconfirm \ - core/gcc \ - extra/llvm \ - extra/clang \ - make \ - ninja \ - curl \ - extra/boost \ - extra/cmake \ - extra/ffmpeg \ - extra/bullet \ - community/glm \ - extra/openal \ - extra/sdl2 \ - extra/qt5-base \ - extra/freetype2 - -# FIXME: lcov - -CMD ["/bin/bash"] diff --git a/scripts/docker/docker_travis.sh b/scripts/docker/docker_travis.sh deleted file mode 100755 index 229b51b51..000000000 --- a/scripts/docker/docker_travis.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -curdir=$(dirname "$(readlink -f "$0")") - -docker=$1 - -# Build docker image -"$curdir/docker_tool.py" build -d "$docker" -t openrw_build_image - -# Start docker container + add travis user -"$curdir/docker_tool.py" create -t openrw_build_image -n openrw_builder -U travis \ - -e \ - NAME_SUFFIX=$NAME_SUFFIX \ - CI=$CI \ - TRAVIS=$TRAVIS \ - SHIPPABLE=$SHIPPABLE \ - CODECOV_ENV=$CODECOV_ENV \ - CODECOV_TOKEN=$CODECOV_TOKEN \ - CODECOV_URL=$CODECOV_URL \ - CODECOV_SLUG=$CODECOV_SLUG \ - TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \ - TRAVIS_BRANCH=$TRAVIS_BRANCH \ - TRAVIS_COMMIT=$TRAVIS_COMMIT \ - TRAVIS_JOB_NUMBER=$TRAVIS_JOB_NUMBER \ - TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST \ - TRAVIS_JOB_ID=$TRAVIS_JOB_ID \ - TRAVIS_TAG=$TRAVIS_TAG \ - TRAVIS_OS_NAME=$TRAVIS_OS_NAME \ - TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \ - USE_CONAN=$USE_CONAN \ - TEST_COVERAGE=$TEST_COVERAGE \ - ALSOFT_DRIVERS=null \ - CC=$CC \ - CXX=$CXX \ - DEBUG=$DEBUG \ - XDG_RUNTIME_DIR=/tmp - -# execute test -"$curdir/docker_tool.py" exec -n openrw_builder -U travis -- /bin/bash -c \ - "ctest -VV -S /src/cmake/ctest/script_ci.ctest" diff --git a/scripts/docker/fedora_latest.docker b/scripts/docker/fedora_latest.docker deleted file mode 100644 index 573ee8cd3..000000000 --- a/scripts/docker/fedora_latest.docker +++ /dev/null @@ -1,30 +0,0 @@ -FROM fedora:latest - -# ffmpeg-devel needs rpmfusion -RUN dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \ - https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm - -RUN dnf update -y \ - && dnf install -y \ - boost-devel \ - gcc \ - gcc-c++ \ - clang \ - llvm \ - lcov \ - curl \ - boost-devel \ - cmake \ - make \ - ninja-build \ - bullet-devel \ - ffmpeg-devel \ - glm-devel \ - openal-soft-devel \ - SDL2-devel \ - qt5-qtbase-devel \ - freetype-devel \ - libasan \ - && ln -s /usr/bin/python3 /usr/bin/python - -CMD ["/bin/bash"] diff --git a/scripts/docker/ubuntu_latest.docker b/scripts/docker/ubuntu_latest.docker deleted file mode 100644 index acf1456c0..000000000 --- a/scripts/docker/ubuntu_latest.docker +++ /dev/null @@ -1,30 +0,0 @@ -FROM ubuntu:latest - -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update \ - && apt-get install --no-install-recommends --no-upgrade -y \ - build-essential \ - cmake \ - ninja-build \ - gcc \ - g++ \ - clang \ - llvm \ - lcov \ - curl \ - libavcodec-dev \ - libavformat-dev \ - libboost-program-options-dev \ - libboost-system-dev \ - libbullet-dev \ - libglm-dev \ - libopenal-dev \ - libsdl2-dev \ - libboost-test-dev \ - libqt5opengl5-dev \ - libfreetype6-dev \ - iwyu \ - qt5-default - -CMD ["/bin/bash"]