feat(CI): rework core ubuntu build, ubuntu-22 support (#17281)
feat(CI): rework core ubuntu build
This commit is contained in:
@@ -0,0 +1,174 @@
|
|||||||
|
name: linux build
|
||||||
|
description: a helper action to shorten running a build on linux
|
||||||
|
inputs:
|
||||||
|
CC:
|
||||||
|
default: clang
|
||||||
|
description: C Compiler to use
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
CXX:
|
||||||
|
default: clang++
|
||||||
|
description: C++ compiler to use
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
modules:
|
||||||
|
default: false
|
||||||
|
description: Flag to install modules or not
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
pch:
|
||||||
|
default: false
|
||||||
|
description: Flag to enable or disable PCH
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/var/ccache
|
||||||
|
# format
|
||||||
|
# ccache:OS:CC_CXX:MODULES:GITHUB_REF:GITHUB_SHA
|
||||||
|
key: ccache:ubuntu-latest:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:${{ github.ref }}:${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
ccache:ubuntu-latest:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:${{ github.ref }}
|
||||||
|
ccache:ubuntu-latest:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}
|
||||||
|
ccache:ubuntu-latest:${{ inputs.CC }}_${{ inputs.CXX }}
|
||||||
|
|
||||||
|
# This script moves sql files from "data/sql/updates/pending_$DB" to the
|
||||||
|
# proper folder for the db
|
||||||
|
- name: Process pending sql
|
||||||
|
shell: bash
|
||||||
|
run: bash apps/ci/ci-pending-sql.sh
|
||||||
|
|
||||||
|
- name: Install build dependencies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt-get -y install ccache clang cmake curl google-perftools \
|
||||||
|
libmysqlclient-dev make unzip build-essential cmake-data \
|
||||||
|
libboost-all-dev libbz2-dev libncurses5-dev libmysql++-dev \
|
||||||
|
libreadline6-dev libssl-dev libtool openssl zlib1g-dev
|
||||||
|
|
||||||
|
# Account for https://github.com/actions/runner-images/issues/8659
|
||||||
|
# based off of https://github.com/actions/runner-images/issues/8659#issuecomment-1852353116
|
||||||
|
UBUNTU_VERSION="$(grep VERSION_ID /etc/os-release | cut -f2 -d\")"
|
||||||
|
source /etc/os-release
|
||||||
|
if [[ "$VERSION_CODENAME" == "jammy" ]]; then
|
||||||
|
if [[ "${{ inputs.cc }}" =~ "clang-" ]]; then
|
||||||
|
CLANG_VERSION="$(echo '${{ inputs.cc }}' | cut -f2 -d\-)"
|
||||||
|
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
|
sudo add-apt-repository "deb http://apt.llvm.org/$VERSION_CODENAME/ llvm-toolchain-$VERSION_CODENAME-$CLANG_VERSION main"
|
||||||
|
sudo apt-get -qq update
|
||||||
|
sudo apt-get -qq install '${{ inputs.cc }}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: setup ccache
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
CCACHE_DIR: $GITHUB_WORKSPACE/var/ccache
|
||||||
|
run: |
|
||||||
|
cat <<EOF >> $GITHUB_ENV
|
||||||
|
CCACHE_DIR=${{ env.CCACHE_DIR }}
|
||||||
|
CCACHE_MAXSIZE=1000MB
|
||||||
|
CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime
|
||||||
|
CCACHE_CPP2=true
|
||||||
|
CCACHE_COMPRESS=1
|
||||||
|
CCACHE_COMPRESSLEVEL=9
|
||||||
|
CCACHE_COMPILERCHECK=content
|
||||||
|
CCACHE_LOGFILE=$CCACHE_DIR/cache.debug
|
||||||
|
CC=${{ inputs.CC }}
|
||||||
|
CXX=${{ inputs.CXX }}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake "$GITHUB_WORKSPACE" \
|
||||||
|
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/env/dist" \
|
||||||
|
-DAPPS_BUILD="all" \
|
||||||
|
-DTOOLS_BUILD="all" \
|
||||||
|
-DSCRIPTS="static" \
|
||||||
|
-DMODULES="static" \
|
||||||
|
-DWITH_WARNINGS="ON" \
|
||||||
|
-DCMAKE_BUILD_TYPE="Release" \
|
||||||
|
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
|
||||||
|
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
|
||||||
|
-DBUILD_TESTING="ON" \
|
||||||
|
-DUSE_SCRIPTPCH=${{ inputs.pch && 'ON' || '' }} \
|
||||||
|
-DUSE_COREPCH=${{ inputs.pch && 'ON' || '' }} \
|
||||||
|
${{ !inputs.pch && '-DNOPCH=true' || '' }}
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
shell: bash
|
||||||
|
working-directory: "${{ github.workspace }}/build"
|
||||||
|
run: cmake --build . --config "Release" -j "$(($(nproc) + 2))"
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
shell: bash
|
||||||
|
working-directory: "${{ github.workspace }}/build"
|
||||||
|
run: cmake --install . --config "Release"
|
||||||
|
|
||||||
|
- name: Setup config
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ls -1 env/dist/etc/*.conf.dist | while read -r dist; do
|
||||||
|
# chop the ".dist" off the end
|
||||||
|
config_name="$(<<< $dist rev | cut -f1 -d\. --complement | rev)"
|
||||||
|
cp -v "$dist" "$config_name"
|
||||||
|
done
|
||||||
|
|
||||||
|
cat <<EOF >> $GITHUB_ENV
|
||||||
|
AC_LOGIN_DATABASE_INFO=localhost;3306;root;root;acore_auth
|
||||||
|
AC_CHARACTER_DATABASE_INFO=localhost;3306;root;root;acore_characters
|
||||||
|
AC_WORLD_DATABASE_INFO=localhost;3306;root;root;acore_world
|
||||||
|
AC_DATA_DIR=env/dist/data
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: get dbc files
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 --branch master --single-branch https://github.com/ac-data/ac-data.git "$AC_DATA_DIR"
|
||||||
|
|
||||||
|
- name: Start MySQL container
|
||||||
|
shell: bash
|
||||||
|
run: sudo systemctl start mysql.service
|
||||||
|
|
||||||
|
- name: run dbimport
|
||||||
|
shell: bash
|
||||||
|
run: env/dist/bin/dbimport
|
||||||
|
|
||||||
|
- name: Dry run authserver
|
||||||
|
shell: bash
|
||||||
|
run: timeout 5m env/dist/bin/authserver --dry-run
|
||||||
|
|
||||||
|
- name: Dry run worldserver
|
||||||
|
shell: bash
|
||||||
|
run: timeout 5m env/dist/bin/worldserver --dry-run
|
||||||
|
|
||||||
|
- name: Check startup errors
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
error_log="./env/dist/bin/Errors.log"
|
||||||
|
# -s checks if the file's size is greater than 0 bytes
|
||||||
|
# ! -s checks if the file's size is less than/equal to 0 bytes
|
||||||
|
# if the error log is empty, exit without error
|
||||||
|
[[ ! -s "$error_log" ]] && exit 0
|
||||||
|
printf "The Errors.log file contains startup errors:\n\n"
|
||||||
|
cat "$error_log"
|
||||||
|
printf "\nPlease solve the startup errors listed above!\n"
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
- name: Run unit tests
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ -f build/obj/src/test/unit_tests ]]; then
|
||||||
|
build/obj/src/test/unit_tests
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
@@ -4,7 +4,10 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
pull_request:
|
pull_request:
|
||||||
types: ['opened', 'synchronize', 'reopened']
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
||||||
@@ -15,42 +18,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# the result of the matrix will be the combination of all attributes, so we get os*compiler builds
|
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
compiler: clang12
|
compiler:
|
||||||
|
CC: gcc-10
|
||||||
|
CXX: g++-10
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
compiler: gcc10
|
compiler:
|
||||||
|
CC: clang-12
|
||||||
|
CXX: clang++-12
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
compiler:
|
||||||
|
CC: clang-15
|
||||||
|
CXX: clang++-15
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
compiler:
|
||||||
|
CC: gcc-13
|
||||||
|
CXX: g++-13
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
name: ${{ matrix.os }}-${{ matrix.compiler }}-nopch
|
name: ${{ matrix.os }}-${{ matrix.compiler.CC }}-nopch
|
||||||
env:
|
|
||||||
COMPILER: ${{ matrix.compiler }}
|
|
||||||
if: github.repository == 'azerothcore/azerothcore-wotlk'
|
if: github.repository == 'azerothcore/azerothcore-wotlk'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Cache
|
- uses: ./.github/actions/linux-build
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: var/ccache
|
CC: ${{ matrix.compiler.CC }}
|
||||||
key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}:${{ github.sha }}
|
CXX: ${{ matrix.compiler.CXX }}
|
||||||
restore-keys: |
|
pch: false
|
||||||
ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}
|
|
||||||
ccache:${{ matrix.os }}:${{ matrix.compiler }}
|
|
||||||
- name: Configure OS
|
|
||||||
run: source ./acore.sh install-deps
|
|
||||||
env:
|
|
||||||
CONTINUOUS_INTEGRATION: true
|
|
||||||
- name: Create conf/config.sh
|
|
||||||
run: source ./apps/ci/ci-conf-core.sh
|
|
||||||
- name: Process pending sql
|
|
||||||
run: bash bin/acore-db-pendings
|
|
||||||
- name: Build
|
|
||||||
run: source ./apps/ci/ci-compile.sh
|
|
||||||
- name: Dry run authserver
|
|
||||||
run: source ./apps/ci/ci-dry-run.sh authserver
|
|
||||||
- name: Dry run worldserver
|
|
||||||
run: source ./apps/ci/ci-dry-run.sh worldserver
|
|
||||||
- name: Check startup errors
|
|
||||||
run: source ./apps/ci/ci-error-check.sh
|
|
||||||
- name: Run unit tests
|
|
||||||
run: source ./apps/ci/ci-run-unit-tests.sh
|
|
||||||
|
|||||||
@@ -15,32 +15,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# the result of the matrix will be the combination of all attributes, so we get os*compiler builds
|
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
compiler: clang12
|
compiler:
|
||||||
|
CC: gcc-10
|
||||||
|
CXX: g++-10
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
compiler:
|
||||||
|
CC: clang-12
|
||||||
|
CXX: clang++-12
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
compiler:
|
||||||
|
CC: clang-15
|
||||||
|
CXX: clang++-15
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
compiler:
|
||||||
|
CC: gcc-13
|
||||||
|
CXX: g++-13
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
name: ${{ matrix.os }}-${{ matrix.compiler }}-pch
|
name: ${{ matrix.os }}-${{ matrix.compiler.CC }}-nopch
|
||||||
env:
|
|
||||||
COMPILER: ${{ matrix.compiler }}
|
|
||||||
if: github.repository == 'azerothcore/azerothcore-wotlk' && !github.event.pull_request.draft
|
if: github.repository == 'azerothcore/azerothcore-wotlk' && !github.event.pull_request.draft
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Configure OS
|
- uses: ./.github/actions/linux-build
|
||||||
run: source ./acore.sh install-deps
|
with:
|
||||||
env:
|
CC: ${{ matrix.compiler.CC }}
|
||||||
CONTINUOUS_INTEGRATION: true
|
CXX: ${{ matrix.compiler.CXX }}
|
||||||
- name: Create conf/config.sh
|
pch: true
|
||||||
run: source ./apps/ci/ci-conf-core-pch.sh
|
|
||||||
- name: Process pending sql
|
|
||||||
run: bash bin/acore-db-pendings
|
|
||||||
- name: Build
|
|
||||||
run: source ./apps/ci/ci-compile.sh
|
|
||||||
- name: Dry run authserver
|
|
||||||
run: source ./apps/ci/ci-dry-run.sh authserver
|
|
||||||
- name: Dry run worldserver
|
|
||||||
run: source ./apps/ci/ci-dry-run.sh worldserver
|
|
||||||
- name: Check startup errors
|
|
||||||
run: source ./apps/ci/ci-error-check.sh
|
|
||||||
- name: Run unit tests
|
|
||||||
run: source ./apps/ci/ci-run-unit-tests.sh
|
|
||||||
|
|||||||
@@ -12,22 +12,13 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-modules:
|
build-modules:
|
||||||
strategy:
|
runs-on: ubuntu-latest
|
||||||
fail-fast: false
|
name: modules build on latest ubuntu
|
||||||
matrix:
|
|
||||||
# the result of the matrix will be the combination of all attributes, so we get os*compiler*modules builds
|
|
||||||
os: [ubuntu-20.04]
|
|
||||||
compiler: [clang]
|
|
||||||
modules: [with]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.modules }}-modules
|
|
||||||
env:
|
|
||||||
COMPILER: ${{ matrix.compiler }}
|
|
||||||
if: |
|
if: |
|
||||||
github.repository == 'azerothcore/azerothcore-wotlk'
|
github.repository == 'azerothcore/azerothcore-wotlk'
|
||||||
&& !github.event.pull_request.draft
|
&& !github.event.pull_request.draft
|
||||||
&& (
|
&& (
|
||||||
github.ref == 'refs/heads/master'
|
github.ref_name == 'master'
|
||||||
|| contains(github.event.pull_request.labels.*.name, 'file-cpp'
|
|| contains(github.event.pull_request.labels.*.name, 'file-cpp'
|
||||||
|| github.event.label.name == 'file-cpp'
|
|| github.event.label.name == 'file-cpp'
|
||||||
|| contains(github.event.pull_request.labels.*.name, 'run-build')
|
|| contains(github.event.pull_request.labels.*.name, 'run-build')
|
||||||
@@ -35,24 +26,9 @@ jobs:
|
|||||||
)
|
)
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Checkout modules
|
- uses: ./.github/actions/linux-build
|
||||||
run: ./apps/ci/ci-install-modules.sh
|
|
||||||
if: matrix.modules == 'with'
|
|
||||||
- name: Cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: var/ccache
|
CC: clang-15
|
||||||
key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.modules }}-modules:${{ github.ref }}:${{ github.sha }}
|
CXX: clang++-15
|
||||||
restore-keys: |
|
modules: true
|
||||||
ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.modules }}-modules:${{ github.ref }}
|
pch: false
|
||||||
ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.modules }}-modules
|
|
||||||
- name: Configure OS
|
|
||||||
run: source ./acore.sh install-deps
|
|
||||||
env:
|
|
||||||
CONTINUOUS_INTEGRATION: true
|
|
||||||
- name: Create conf/config.sh
|
|
||||||
run: source ./apps/ci/ci-conf-core.sh
|
|
||||||
- name: Process pending sql
|
|
||||||
run: bash bin/acore-db-pendings
|
|
||||||
- name: Build
|
|
||||||
run: source ./apps/ci/ci-compile.sh
|
|
||||||
|
|||||||
Reference in New Issue
Block a user