From 2752faf2e4ef8c76a3f0787f6f1720758127e479 Mon Sep 17 00:00:00 2001 From: Niam5 Date: Tue, 4 Apr 2023 22:58:53 -0700 Subject: [PATCH] Change CI to GitHub Actions -Remove CircleCI and Jenkins files -Add Windows and Ubuntu build on push actions -Update build status badge in Readme -Move PR and Issue templates to new folder -Add auto merge and after build script --- .circleci/config.yml | 162 ------------------ .../ISSUE_TEMPLATE.md | 0 .../PULL_REQUEST_TEMPLATE.md | 0 .github/workflows/auto-merge.yml | 47 +++++ .../workflows/{gcc-build.yml => ubuntu.yml} | 19 +- .github/workflows/windows.yml | 71 ++++++++ Jenkinsfile | 66 ------- README.md | 4 +- appveyor.yml | 58 ------- 9 files changed, 132 insertions(+), 295 deletions(-) delete mode 100644 .circleci/config.yml rename issue_template.md => .github/ISSUE_TEMPLATE.md (100%) rename pull_request_template.md => .github/PULL_REQUEST_TEMPLATE.md (100%) create mode 100644 .github/workflows/auto-merge.yml rename .github/workflows/{gcc-build.yml => ubuntu.yml} (58%) create mode 100644 .github/workflows/windows.yml delete mode 100644 Jenkinsfile delete mode 100644 appveyor.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index bf27375e3b0..00000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,162 +0,0 @@ -version: 2 -jobs: - codestyle_and_sql: - docker: - - image: cataclysmpreservationproject/circle-ci:master-base-22.04 - auth: - username: $DOCKERHUB_USERNAME - password: $DOCKERHUB_PASSWORD - - image: cimg/mysql:8.0 - auth: - username: $DOCKERHUB_USERNAME - password: $DOCKERHUB_PASSWORD - environment: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_ROOT_PASSWORD: '' - MYSQL_DATABASE: test_mysql - steps: - - run: - name: Checkout - command: | - /scripts/checkout.sh - - run: - name: Codestyle checks - command: | - chmod +x contrib/check_codestyle.sh - ./contrib/check_codestyle.sh - - run: - name: SQL checks - command: | - chmod +x contrib/check_updates.sh - dockerize -wait tcp://127.0.0.1:3306 -timeout 120s - mysql -h 127.0.0.1 -uroot < sql/create/create_mysql.sql - mysql -h 127.0.0.1 -uroot auth < sql/base/auth_database.sql - ./contrib/check_updates.sh auth 4.3.4 auth 127.0.0.1 - mysql -h 127.0.0.1 -uroot characters < sql/base/characters_database.sql - ./contrib/check_updates.sh characters 4.3.4 characters 127.0.0.1 - echo "Importing world database structure" - mysql -h 127.0.0.1 -uroot world < sql/base/dev/world_database.sql - echo "Importing hotfixes database structure" - mysql -h 127.0.0.1 -uroot hotfixes < sql/base/dev/hotfixes_database.sql - echo "Importing world database updates" - cat sql/updates/world/4.3.4/*.sql | mysql -h 127.0.0.1 -uroot world - echo "Importing hotfixes database updates" - cat sql/updates/hotfixes/4.3.4/*.sql | mysql -h 127.0.0.1 -uroot hotfixes - pch: - docker: - - image: cataclysmpreservationproject/circle-ci:master-base-22.04 - auth: - username: $DOCKERHUB_USERNAME - password: $DOCKERHUB_PASSWORD - steps: - - run: - name: Checkout - command: | - /scripts/checkout.sh - - run: - name: Setup - command: | - mkdir bin - cd bin - if [ "$DOCKERHUB_PUSH_IMAGES" == "TRUE" ]; then - cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_INSTALL_PREFIX=check_install -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib -DBUILD_TESTING=1 - else - cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib -DBUILD_TESTING=1 - fi - cd .. - - run: - name: Build - command: | - cd bin - make -j 4 -k && make install - - run: - name: Unit tests - command: | - cd bin - make test - - run: - name: Check executables - command: | - cd bin/check_install/bin - ./bnetserver --version - ./worldserver --version - - setup_remote_docker: - version: 19.03.13 - - run: - name: Create docker images - command: | - cd bin/check_install - cp -r ../../contrib/Docker/* . - cp -r ../../sql ./sql - image_prefix=$(echo cataclysmpreservationproject/$CIRCLE_PROJECT_REPONAME | tr '[:upper:]' '[:lower:]') - echo $image_prefix - docker build --file Dockerfile --force-rm --tag $image_prefix:$CIRCLE_SHA1 --tag $image_prefix:$(echo $CIRCLE_BRANCH | tr '/' '-' | tr '[:upper:]' '[:lower:]') . - docker save $image_prefix | gzip > ../../docker.tar.gz - if [ "$DOCKERHUB_PUSH_IMAGES" == "TRUE" ]; then - if [ "$CIRCLE_BRANCH" == "master" ]; then - docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD - echo "Pushing docker image to dockerhub" - docker push --all-tags $image_prefix - fi - fi - - store_artifacts: - path: docker.tar.gz - nopch: - docker: - - image: cataclysmpreservationproject/circle-ci:master-base-22.04 - auth: - username: $DOCKERHUB_USERNAME - password: $DOCKERHUB_PASSWORD - steps: - - run: - name: Requirements - command: | - sudo mkdir -p /root/.ccache - sudo chown -Rv circleci:circleci /root - - run: - name: Checkout - command: | - /scripts/checkout.sh - - restore_cache: - keys: - - master-nopch-{{ .Branch }}-{{ .Revision }} - - master-nopch-{{ .Branch }} - - master-nopch-master - - run: - name: Setup - command: | - export CCACHE_MAXSIZE="1G" - export CC="ccache clang" - export CXX="ccache clang++" - export CCACHE_CPP2=yes - export USE_CCACHE=1 - export PATH=/usr/lib/ccache:$PATH - export CCACHE_DIR=$HOME/.ccache - ccache -z - ccache -s - git config user.email "circleci@build.bot" && git config user.name "Circle CI" - $CXX --version - mkdir bin - cd bin - cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=0 -DUSE_SCRIPTPCH=0 -DTOOLS=1 -DSCRIPTS=dynamic -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install - cd .. - - run: - name: Build - command: | - cd bin - make -j 4 -k && make install - ccache -s - cd check_install/bin - ./bnetserver --version - ./worldserver --version - - save_cache: - key: master-nopch-{{ .Branch }}-{{ .Revision }} - paths: - - /home/circleci/.ccache -workflows: - version: 2 - build_all: - jobs: - - codestyle_and_sql - - pch - - nopch diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 100% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md diff --git a/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from pull_request_template.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 00000000000..7053c25b7c6 --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,47 @@ +name: automerge + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + merge: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 0 + - name: Merge TCPP + run: | + git status + git config user.email "niam5+ci@post.com" && git config user.name "Niam5" + git remote add Cata https://github.com/The-Cataclysm-Preservation-Project/TrinityCore.git + git fetch Cata master + git merge -m "Merge TheCataclysmPreservationProject to ElunaCataPreservation [skip ci]" Cata/master + git status + - name: Dependencies + run: | + sudo apt-get update && sudo apt-get install -yq libboost-all-dev + - name: Setup + run: | + mkdir bin + cd bin + cmake ../ -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DELUNA=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1 + cd .. + - name: Build + run: | + cd bin + make -j 4 -k && make install + - name: Unit tests + run: | + cd bin + make test + - name: Check executables + run: | + cd bin/check_install/bin + ./bnetserver --version + ./worldserver --version + - name: Push changes + run: | + git push --force diff --git a/.github/workflows/gcc-build.yml b/.github/workflows/ubuntu.yml similarity index 58% rename from .github/workflows/gcc-build.yml rename to .github/workflows/ubuntu.yml index e1a391c6128..17c1c8ffe63 100644 --- a/.github/workflows/gcc-build.yml +++ b/.github/workflows/ubuntu.yml @@ -1,34 +1,39 @@ -name: GCC +name: Ubuntu build -on: - push: - pull_request: +on: [push] jobs: build: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + with: + submodules: true + - name: Dependencies run: | sudo apt-get update && sudo apt-get install -yq libboost-all-dev g++-10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 + - name: Setup run: | mkdir bin cd bin - cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_C_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="-DNDEBUG" -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1 + cmake ../ -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DELUNA=1 -DTOOLS=1 -DSCRIPTS=static -DSERVERS=1 -DNOJEM=0 -DCMAKE_INSTALL_PREFIX=check_install -DBUILD_TESTING=1 cd .. + - name: Build run: | cd bin make -j 4 -k && make install + - name: Unit tests run: | cd bin make test + - name: Check executables run: | cd bin/check_install/bin ./bnetserver --version - ./worldserver --version + ./worldserver --version \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000000..36966f86ded --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,71 @@ +name: Windows build + +on: [push] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: RelWithDebInfo + REPO_DIR : ${{github.workspace}} + BUILD_DIR: ${{github.workspace}}/bin/builddir + BOOST_TOOLSET: "msvc" + BOOST_VERSION: "1.79.0" + BOOST_PLATFORM_VERSION: "2022" + +jobs: + build: + runs-on: windows-2022 + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + path: ${{env.REPO_DIR}} + submodules: true + + - name: Create Build Environment + run: | + echo "ARCHIVE_FILENAME=${{ github.event.repository.name }}-$(git rev-parse --short HEAD).zip" >> $env:GITHUB_ENV + cmake -E make_directory ${{ env.BUILD_DIR }} + + # install dependencies + - name: Install boost + uses: MarkusJx/install-boost@v2.4.1 + id: install-boost + with: + # REQUIRED: Specify the required boost version + # A list of supported versions can be found here: + # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json + boost_version: ${{env.BOOST_VERSION}} + # OPTIONAL: Specify a platform version + platform_version: ${{env.BOOST_PLATFORM_VERSION}} + # OPTIONAL: Specify a toolset + toolset: ${{env.BOOST_TOOLSET}} + # NOTE: If a boost version matching all requirements cannot be found, + # this build step will fail + + - name: Install OpenSSL + run: | + choco install openssl + + - name: Configure + env: + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + run: cmake -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DELUNA=1 -DSCRIPTS=static -DSERVERS=1 -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}} + + - name: Build + env: + MAKEFLAGS: "-j8" + run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}} + + - name: Archive files + run: | + cd ${{env.BUILD_DIR}}/bin + 7z a -tzip ${{env.ARCHIVE_FILENAME}} RelWithDebInfo + + - name: Archive this artifact + uses: actions/upload-artifact@v3 + with: + name: snapshot + path: "${{env.BUILD_DIR}}/bin/${{env.ARCHIVE_FILENAME}}" diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index c9b4d9a4f22..00000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,66 +0,0 @@ -pipeline { - parameters { - string(name: 'BUILD_THREADS', defaultValue: '', description: 'Build threads') - - string(name: 'WITH_DYNAMIC_LINKING', defaultValue: '0', description: 'Build Option WITH_DYNAMIC_LINKING') - string(name: 'SCRIPTS', defaultValue: 'static', description: 'Build Option SCRIPTS') - string(name: 'BNETSERVER', defaultValue: '1', description: 'Build Option BNETSERVER') - string(name: 'WORLDSERVER', defaultValue: '1', description: 'Build Option WORLDSERVER') - string(name: 'TOOLS', defaultValue: '0', description: 'Build Option TOOLS') - string(name: 'WITH_WARNINGS', defaultValue: '1', description: 'Build Option WITH_WARNINGS') - string(name: 'USE_COREPCH', defaultValue: '1', description: 'Build Option USE_COREPCH') - string(name: 'USE_SCRIPTPCH', defaultValue: '1', description: 'Build Option USE_SCRIPTPCH') - string(name: 'WITH_COREDEBUG', defaultValue: '0', description: 'Build Option WITH_COREDEBUG') - string(name: 'CMAKE_BUILD_TYPE', defaultValue: 'RelWithDebInfo', description: 'Build Option CMAKE_BUILD_TYPE') - string(name: 'CMAKE_ADDITIONAL', defaultValue: '', description: 'Additional CMake parameters') - } - - agent { - node { - label '' - customWorkspace "/srv/jenkins/${JOB_NAME}" - } - } - - options { - buildDiscarder(logRotator(daysToKeepStr: '30')) - checkoutToSubdirectory('git') - disableConcurrentBuilds() - timestamps() - } - - stages { - stage('Build') { - steps { - echo 'Building...' - dir('build') { - sh "cmake ../git -DCMAKE_INSTALL_PREFIX=../ -DWITH_DYNAMIC_LINKING=${params.WITH_DYNAMIC_LINKING} -DSCRIPTS=${params.SCRIPTS} -DBNETSERVER=${params.BNETSERVER} -DWORLDSERVER=${params.WORLDSERVER} -DTOOLS=${params.TOOLS} -DWITH_WARNINGS=${params.WITH_WARNINGS} -DUSE_COREPCH=${params.USE_COREPCH} -DUSE_SCRIPTPCH=${params.USE_SCRIPTPCH} -DWITH_COREDEBUG=${params.WITH_COREDEBUG} -DCMAKE_BUILD_TYPE=${params.CMAKE_BUILD_TYPE} -DBoost_NO_BOOST_CMAKE=ON ${params.CMAKE_ADDITIONAL}" - sh """ - set +x - - THREADS="${GLOBAL_BUILD_THREADS}" - - if [ ! -z "${params.BUILD_THREADS}" ]; then - THREADS="${params.BUILD_THREADS}" - fi - - echo "Build started with \${THREADS} threads." - make -j\${THREADS} -k - """ - } - } - } - stage('Deploy') { - steps { - echo 'Deploying...' - dir('build') { - sh 'make install' - } - dir('bin') { - sh './bnetserver --version' - sh './worldserver --version' - } - } - } - } -} diff --git a/README.md b/README.md index c6e7288d0d3..1eaf2e72041 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ 4.3.4 (master) :------------: -[![CircleCI Status](https://circleci.com/gh/The-Cataclysm-Preservation-Project/TrinityCore.svg?style=shield&branch=master)](https://app.circleci.com/pipelines/github/The-Cataclysm-Preservation-Project/TrinityCore?branch=master) -[![AppVeyor Status](https://ci.appveyor.com/api/projects/status/github/The-Cataclysm-Preservation-Project/TrinityCore?branch=master&svg=true)](https://ci.appveyor.com/project/Ovahlord/trinitycore) +[![Windows build](https://github.com/Niam5/ElunaCataPreservation/actions/workflows/windows.yml/badge.svg)](https://github.com/Niam5/ElunaCataPreservation/actions/workflows/windows.yml) +[![Ubuntu build](https://github.com/Niam5/ElunaCataPreservation/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/Niam5/ElunaCataPreservation/actions/workflows/ubuntu.yml) ## Introduction diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 4afd3aa633d..00000000000 --- a/appveyor.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 1.0.{build} -image: Visual Studio 2022 -clone_depth: 1 -init: -- ps: '' -environment: - BOOST_ROOT: C:\Libraries\boost_1_83_0 - MYSQL_ROOT_DIR: C:\mysql-8.1.0-winx64 - OPENSSL_ROOT_DIR: C:\OpenSSL-v30-Win64 -install: -- ps: >- - Write-Host "Installing MySQL Server 8.1" -ForegroundColor Cyan - - Write-Host "Downloading MySQL..." - - $zipPath = "$($env:temp)\mysql-8.1.0-winx64.zip" - - (New-Object Net.WebClient).DownloadFile('https://cdn.mysql.com//Downloads/MySQL-8.1/mysql-8.1.0-winx64.zip', $zipPath) - - Write-Host "Unpacking..." - - 7z x $zipPath -o"C:\" | Out-Null - - Write-Host "MySQL Server 8.1 installed" -ForegroundColor Cyan - -build_script: -- cmd: >- - git config user.email "appveyor@build.bot" && git config user.name "AppVeyor" - - md build && cd build - - cmake -G"Visual Studio 17 2022" -A x64 -DSCRIPTS=static -DTOOLS=True -DCMAKE_CXX_FLAGS=" /DWIN32 /D_WINDOWS /W3 /GR /EHsc /WX" -DCMAKE_C_FLAGS="/DWIN32 /D_WINDOWS /W3 /WX" .. - - "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" /nologo /m:2 /p:Configuration=RelWithDebInfo /p:Platform="X64" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" "TrinityCore.sln" - - cd bin\RelWithDebInfo\ - - copy "%MYSQL_ROOT_DIR%\lib\libmysql.dll" libmysql.dll - - copy "%OPENSSL_ROOT_DIR%\libssl-3-x64.dll" libssl-3-x64.dll - - copy "%OPENSSL_ROOT_DIR%\libcrypto-3-x64.dll" libcrypto-3-x64.dll - - cd .. - - 7z a TrinityCoreWin64VS2022.zip .\RelWithDebInfo\* - - del /F /Q /S "RelWithDebInfo\*.pdb" > NUL - - 7z a TrinityCoreWin64VS2022NoSymbols.zip .\RelWithDebInfo\* - -test: off -artifacts: -- path: build\bin\TrinityCoreWin64VS2022.zip - name: TrinityCoreWin64VS2022 - -- path: build\bin\TrinityCoreWin64VS2022NoSymbols.zip - name: TrinityCoreWin64VS2022NoSymbols