From 3d0f0a3d9e27590e30d910d992188ccf370ac10b Mon Sep 17 00:00:00 2001 From: Graham Pentheny Date: Sat, 12 Nov 2022 13:27:46 -0500 Subject: [PATCH] Github Workflows based CI system to replace Appveyor and Travis (#580) The goal here is to replace the current (slightly broken) Travis + Appveyor setup with something that covers more cases and is a bit better supported and easier to maintain. This hopefully helps us catch cross-platform issues quicker. For example, the linux and clang compilation issues that have existed for a while could have been caught if we were building those targets in CI. This adds a build script that builds the following configurations for every repo commit and PR: macOS, premake, Debug macOS, premake, Release linux, premake, gcc, Debug linux, premake, gcc, Release linux, premake, clang, Debug linux, premake, clang, Release linux, cmake, Debug linux, cmake, Release windows, premake, vs2019, Debug windows, premake, vs2019, Release windows, premake, vs2022, Debug windows, premake, vs2022, Release windows, cmake, vs2019, Debug windows, cmake, vs2019, Release windows, cmake, vs2022, Debug windows, cmake, vs2022, Release It also builds and runs the catch tests executable in the following configurations. A failed test will fail the build. macOS, premake, Debug linux, premake, clang, Debug windows, premake, vs2022, Debug It doesn't currently build cmake on macOS because there is a one blocker there (#577). We could also add additional builds like cmake with both clang and gcc on linux, but for now this is much better coverage than we have currently. --- .github/workflows/Build.yaml | 190 +++++++++++++++++++++++++++++++++++ .github/workflows/Tests.yaml | 107 ++++++++++++++++++++ .travis.yml | 52 ---------- appveyor.yml | 50 --------- 4 files changed, 297 insertions(+), 102 deletions(-) create mode 100644 .github/workflows/Build.yaml create mode 100644 .github/workflows/Tests.yaml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml new file mode 100644 index 0000000..eb45d56 --- /dev/null +++ b/.github/workflows/Build.yaml @@ -0,0 +1,190 @@ +name: Build + +on: + push: + branches: [ "**" ] + pull_request: + branches: [ "**" ] + +jobs: + macOS-premake: + strategy: + matrix: + conf: + - Debug + - Release + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + + - name: Download & install SDL + run: | + curl -L -o SDL2.dmg https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-2.24.2.dmg + hdiutil attach SDL2.dmg + cp -r /Volumes/SDL2/SDL2.framework RecastDemo/Bin + hdiutil detach /Volumes/SDL2 + rm SDL2.dmg + + - name: Download & install premake + working-directory: RecastDemo + run: | + curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-macosx.tar.gz + tar -xzf premake.tar.gz + rm premake.tar.gz + + - name: Run premake + working-directory: RecastDemo + run: ./premake5 xcode4 + + - name: Build With Xcode + working-directory: RecastDemo/Build/xcode4/ + run: xcodebuild -scheme RecastDemo -configuration ${{matrix.conf}} -project RecastDemo.xcodeproj build + + - name: Build Unit Tests With Xcode + working-directory: RecastDemo/Build/xcode4/ + run: xcodebuild -scheme Tests -configuration ${{matrix.conf}} -project Tests.xcodeproj build + + linux-premake: + strategy: + matrix: + conf: + - debug + - release + compiler: + - clang + - gcc + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install opengl and SDL + run: sudo apt-get install -y libgl1-mesa-dev libsdl2-dev + + - name: Download & Install premake + working-directory: RecastDemo + run: | + curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz + tar -xzf premake.tar.gz + rm premake.tar.gz + + - name: Run premake + working-directory: RecastDemo + run: ./premake5 --cc=${{matrix.compiler}} gmake2 + + - name: Build + working-directory: RecastDemo/Build/gmake2 + run: make config=${{matrix.conf}} verbose=true + + linux-cmake: + strategy: + matrix: + conf: + - Debug + - Release + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install opengl and SDL + run: sudo apt-get install -y libgl1-mesa-dev libsdl2-dev + + - name: Configure CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.conf}} + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{matrix.conf}} + + windows-premake: + strategy: + matrix: + conf: + - Debug + - Release + vs-version: + - vs2019 + - vs2022 + include: + - vs-version: vs2019 + version-range: '16.0' + runner: windows-2019 + - vs-version: vs2022 + version-range: '17.0' + runner: windows-2022 + + runs-on: ${{matrix.runner}} + + steps: + - uses: actions/checkout@v3 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.1 + with: + vs-version: ${{matrix.version-range}} + + - name: Download and Install SDL + working-directory: RecastDemo/Contrib + shell: pwsh + run: | + (new-object System.Net.WebClient).DownloadFile("https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-devel-2.24.2-VC.zip","${{github.workspace}}/RecastDemo/Contrib/SDL.zip") + tar -xf SDL.zip + ren SDL2-2.24.2 SDL + del SDL.zip + + - name: Download and Install Premake + working-directory: RecastDemo + shell: pwsh + run: | + (new-object System.Net.WebClient).DownloadFile("https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip","${{github.workspace}}/RecastDemo/premake.zip") + tar -xf premake.zip + del premake.zip + + - name: Run Premake + working-directory: RecastDemo + run: ./premake5.exe ${{matrix.vs-version}} + + - name: Build + working-directory: RecastDemo/Build/${{matrix.vs-version}} + run: msbuild RecastDemo.vcxproj -property:Configuration=${{matrix.conf}} + + windows-cmake: + strategy: + matrix: + conf: + - Debug + - Release + vs-version: + - vs2019 + - vs2022 + include: + - vs-version: vs2019 + cmake-generator: Visual Studio 16 2019 + runner: windows-2019 + - vs-version: vs2022 + cmake-generator: Visual Studio 17 2022 + runner: windows-2022 + + runs-on: ${{matrix.runner}} + + steps: + - uses: actions/checkout@v3 + + - name: Download and Install SDL + working-directory: RecastDemo/Contrib + shell: pwsh + run: | + (new-object System.Net.WebClient).DownloadFile("https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-devel-2.24.2-VC.zip","${{github.workspace}}/RecastDemo/Contrib/SDL.zip") + tar -xf SDL.zip + ren SDL2-2.24.2 SDL + del SDL.zip + + - name: Configure CMake + run: cmake -G "${{matrix.cmake-generator}}" -B ${{github.workspace}}/build -D CMAKE_BUILD_TYPE=${{matrix.conf}} -D CMAKE_INSTALL_PREFIX=${{github.workspace}}/build + + - name: Build with CMake + run: cmake --build ${{github.workspace}}/build --config ${{matrix.conf}} diff --git a/.github/workflows/Tests.yaml b/.github/workflows/Tests.yaml new file mode 100644 index 0000000..149fa01 --- /dev/null +++ b/.github/workflows/Tests.yaml @@ -0,0 +1,107 @@ +name: Tests + +on: + push: + branches: [ "**" ] + pull_request: + branches: [ "**" ] + +jobs: + macos-tests: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + + - name: Download & install SDL + run: | + curl -L -o SDL2.dmg https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-2.24.2.dmg + hdiutil attach SDL2.dmg + cp -r /Volumes/SDL2/SDL2.framework RecastDemo/Bin + hdiutil detach /Volumes/SDL2 + rm SDL2.dmg + + - name: Download & install premake + working-directory: RecastDemo + run: | + curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-macosx.tar.gz + tar -xzf premake.tar.gz + rm premake.tar.gz + + - name: Run premake + working-directory: RecastDemo + run: ./premake5 xcode4 + + - name: Build Unit Tests With Xcode + working-directory: RecastDemo/Build/xcode4/ + run: xcodebuild -scheme Tests -configuration Debug -project Tests.xcodeproj build + + - name: Run unit tests + working-directory: RecastDemo/Bin + run: ./Tests + + linux-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install opengl and SDL + run: sudo apt-get install -y libgl1-mesa-dev libsdl2-dev + + - name: Download & Install premake + working-directory: RecastDemo + run: | + curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz + tar -xzf premake.tar.gz + rm premake.tar.gz + + - name: Run premake + working-directory: RecastDemo + run: ./premake5 --cc=clang gmake2 + + - name: Build + working-directory: RecastDemo/Build/gmake2 + run: make config=debug verbose=true + + - name: Run Tests + working-directory: RecastDemo/Bin + run: ./Tests + + windows-tests: + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v3 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.1 + + - name: Download and Install SDL + working-directory: RecastDemo/Contrib + shell: pwsh + run: | + (new-object System.Net.WebClient).DownloadFile("https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-devel-2.24.2-VC.zip","${{github.workspace}}/RecastDemo/Contrib/SDL.zip") + tar -xf SDL.zip + ren SDL2-2.24.2 SDL + del SDL.zip + + - name: Download and Install Premake + working-directory: RecastDemo + shell: pwsh + run: | + (new-object System.Net.WebClient).DownloadFile("https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip","${{github.workspace}}/RecastDemo/premake.zip") + tar -xf premake.zip + del premake.zip + + - name: Run Premake + working-directory: RecastDemo + run: ./premake5.exe vs2022 + + - name: Build + working-directory: RecastDemo/Build/vs2022 + run: msbuild Tests.vcxproj -property:Configuration=Debug + + - name: Run Tests + working-directory: RecastDemo/Bin/ + run: ./Tests.exe \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6cd8bbc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,52 +0,0 @@ -language: cpp -os: linux -dist: bionic -branches: - only: - - master - - coverity_scan - - /recast-.*$/ - -sudo: false - -addons: - apt: - packages: [ build-essential, cmake, clang, clang-tools, libsdl2-dev ] - -matrix: - include: - - name: Recastnavigation on MacOS using XCode - os: osx - osx_image: xcode12.2 - before_install: - - brew update - - brew install sdl2 - if: branch != coverity_scan - - name: Recastnavigation on Ubuntu GCC - if: branch != coverity_scan - - name: Recastnavigation on Ubuntu GCC using Premake5 - if: branch != coverity_scan - before_install: - - wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz -O premake.tar.gz - - tar -xf premake.tar.gz - env: - - PREMAKE=1 - - name: Recastnavigation on Ubuntu Clang with Static Analysis - env: - - MATRIX_EVAL="CC=clang && CXX=clang++" - - ANALYZE="scan-build --force-analyze-debug-code --use-cc clang --use-c++ clang++" - if: branch != coverity_scan - compiler: clang - - name: Recastnavigation Coverity Scan - if: branch = coverity_scan - -before_script: - - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then eval "${MATRIX_EVAL}"; fi - - if [ "${PREMAKE}" = "1" ]; then cd RecastDemo && ../premake5 gmake && cd ..; fi - - if [ "${PREMAKE}" != "1" ]; then mkdir -p build && cd build && ${ANALYZE} cmake ../ && cd ..; fi - -script: # 2 CPUs on Travis-CI + 1 extra for IO bound process - - if [ "${PREMAKE}" = "1" ]; then make -C RecastDemo/Build/gmake -j3; fi - - if [ "${PREMAKE}" != "1" ]; then make -C build -j3; fi - - if [ "${PREMAKE}" = "1" ]; then RecastDemo/Bin/Tests; fi - - if [ "${PREMAKE}" != "1" ]; then cd build && ctest; fi diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index dd4e3ab..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,50 +0,0 @@ -shallow_clone: true - -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - PREMAKE_ACTION: vs2017 - CMAKE_GENERATOR: Visual Studio 15 2017 Win64 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PREMAKE_ACTION: vs2019 - CMAKE_GENERATOR: Visual Studio 16 2019 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - PREMAKE_ACTION: vs2022 - CMAKE_GENERATOR: Visual Studio 17 2022 - -configuration: - - Debug - - Release - -platform: - - Win64 - -install: - # Download Premake - - ps: Start-FileDownload 'https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip' 'premake.zip' - - # Extract it in-place; premake5.exe is at the top level. - - 7z x premake.zip - - # Download SDL. - - ps: Start-FileDownload 'https://www.libsdl.org/release/SDL2-devel-2.0.4-VC.zip' 'RecastDemo/Contrib/SDL.zip' - - # Extract it, put it in the right place, and rename it. - - cd RecastDemo\Contrib && 7z x SDL.zip && ren SDL2-2.0.4 SDL && cd ..\.. - - # Generate solution files using premake. - - cd RecastDemo && "../premake5.exe" %PREMAKE_ACTION% && cd .. - -build: - project: RecastDemo/Build/$(PREMAKE_ACTION)/recastnavigation.sln - -after_build: - - mkdir build - - cd build - - cmake -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE="%CONFIGURATION%" -D CMAKE_INSTALL_PREFIX=. .. - - cmake --build . --config "%CONFIGURATION%" --target install -- /m:%NUMBER_OF_PROCESSORS% - - ctest -V - - cd .. - -after_test: - - RecastDemo\Bin\Tests.exe