forked from otland/forgottenserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build (cmake) and CI/CD updates (otland#2973)
* cmake is upgraded and related configs modified * build using cmake on Windows (with vcpkg) is now possible * cotire is not used when redundant (cmake >= 3.16) * Lua version shown on startup * Github Actions
- Loading branch information
1 parent
c29b913
commit 4233f74
Showing
25 changed files
with
1,260 additions
and
726 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Build on Ubuntu | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- v* | ||
|
||
tags: | ||
- v* | ||
|
||
paths: | ||
- cmake/** | ||
- src/** | ||
- CMakeLists.txt | ||
|
||
pull_request: | ||
paths: | ||
- cmake/** | ||
- src/** | ||
- CMakeLists.txt | ||
|
||
jobs: | ||
build-ubuntu: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: > | ||
sudo apt-get install git cmake build-essential libluajit-5.1-dev libmysqlclient-dev | ||
libboost-date-time-dev libboost-system-dev libboost-iostreams-dev libboost-filesystem-dev | ||
libpugixml-dev libcrypto++-dev | ||
- name: Build with cmake | ||
uses: ashutoshvarma/action-cmake-build@master | ||
with: | ||
build-dir: ${{ runner.workspace }}/build | ||
# will set the CC & CXX for cmake | ||
cc: gcc | ||
cxx: g++ | ||
build-type: Release | ||
# Extra options pass to cmake while configuring project | ||
configure-options: -DUSE_LUAJIT=on | ||
# run build using '-j [parallel]' to use multiple threads to build | ||
parallel: 2 | ||
|
||
- name: Upload binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ubuntu-tfs-amd64-${{ github.sha }} | ||
path: ${{ runner.workspace }}/build/tfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: Build with vcpkg | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- v* | ||
|
||
tags: | ||
- v* | ||
|
||
paths: | ||
- cmake/** | ||
- src/** | ||
- CMakeLists.txt | ||
|
||
pull_request: | ||
paths: | ||
- cmake/** | ||
- src/** | ||
- CMakeLists.txt | ||
|
||
jobs: | ||
job: | ||
name: ${{ matrix.os }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }} | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 8 | ||
matrix: | ||
os: [ubuntu, windows, macos] | ||
buildtype: [Debug, Release] | ||
luajit: [on, off] | ||
include: | ||
- os: windows | ||
triplet: x64-windows | ||
packages: > | ||
boost-asio boost-iostreams boost-system boost-filesystem boost-variant boost-lockfree | ||
lua luajit libmariadb pugixml cryptopp | ||
- os: ubuntu | ||
triplet: x64-linux | ||
packages: > | ||
boost-asio boost-iostreams boost-system boost-filesystem boost-variant boost-lockfree | ||
lua libmariadb pugixml cryptopp | ||
- os: macos | ||
triplet: x64-osx | ||
packages: > | ||
boost-asio boost-iostreams boost-system boost-filesystem boost-variant boost-lockfree | ||
lua libmariadb pugixml cryptopp | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Get latest CMake | ||
# Using 'latest' branch, the latest CMake is installed. | ||
uses: lukka/get-cmake@latest | ||
|
||
- name: Ubuntu - install luajit, remove libmysqlclient-dev | ||
run: | | ||
sudo apt-get install libluajit-5.1-dev | ||
sudo apt-get remove -y libmysqlclient-dev | ||
if: contains( matrix.os, 'ubuntu') | ||
|
||
- name: MacOS - install luajit pkgconfig | ||
run: brew install luajit pkgconfig | ||
if: contains( matrix.os, 'macos') | ||
|
||
- name: Windows - remove C:/mysql* | ||
run: rm -r -fo C:/mysql-5.7.21-winx64 | ||
if: contains( matrix.os, 'windows') | ||
|
||
- name: Run vcpkg | ||
uses: lukka/run-vcpkg@v2 | ||
with: | ||
vcpkgArguments: ${{ matrix.packages }} | ||
vcpkgDirectory: ${{ runner.workspace }}/vcpkg | ||
vcpkgTriplet: ${{ matrix.triplet }} | ||
vcpkgGitCommitId: c444db5f5a954bd53c8dad004cee39c4064d844e | ||
|
||
- name: Build with CMake | ||
uses: lukka/run-cmake@v2 | ||
with: | ||
useVcpkgToolchainFile: true | ||
buildDirectory: ${{ runner.workspace }}/build | ||
cmakeBuildType: ${{ matrix.buildtype }} | ||
cmakeAppendedArgs: -DUSE_LUAJIT=${{ matrix.luajit }} | ||
|
||
- name: dir | ||
run: find $RUNNER_WORKSPACE | ||
shell: bash | ||
|
||
- name: Upload artifact binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tfs-${{ matrix.os }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}-${{ github.sha }} | ||
path: ${{ runner.workspace }}/build/tfs | ||
if: "! contains( matrix.os, 'windows')" | ||
|
||
- name: Upload artifact binary (exe) | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tfs-${{ matrix.os }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}-${{ github.sha }} | ||
path: ${{ runner.workspace }}/build/tfs.exe | ||
if: contains( matrix.os, 'windows') | ||
|
||
- name: Upload artifact binary (dlls) | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tfs-${{ matrix.os }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}-${{ github.sha }} | ||
path: ${{ runner.workspace }}/build/*.dll | ||
if: contains( matrix.os, 'windows') | ||
|
||
- name: Prepare datapack contents | ||
run: find . -maxdepth 1 ! -name data ! -name config.lua.dist ! -name key.pem ! -name LICENSE ! -name README.md ! -name schema.sql -exec rm -r {} \; | ||
shell: bash | ||
|
||
- name: Upload datapack contents | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tfs-${{ matrix.os }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}-${{ github.sha }} | ||
path: ${{ github.workspace }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Coverity | ||
on: | ||
repository_dispatch: | ||
types: coverity_scan | ||
schedule: | ||
- cron: '0 0 * * 5' # Weekly at 00:00 UTC | ||
|
||
env: | ||
COVERITY_PROJECT: otland/forgottenserver | ||
COVERITY_EMAIL: [email protected] | ||
|
||
jobs: | ||
scan: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'otland/forgottenserver' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: > | ||
sudo apt-get install git cmake build-essential libluajit-5.1-dev libgmp3-dev libmysqlclient-dev | ||
libboost-date-time-dev libboost-system-dev libboost-iostreams-dev libboost-filesystem-dev | ||
libpugixml-dev libcrypto++-dev | ||
- name: Get latest CMake | ||
# Using 'latest' branch, the latest CMake is installed. | ||
uses: lukka/get-cmake@latest | ||
|
||
- name: Download Coverity Build Tool | ||
run: | | ||
cd ${{ runner.workspace }} | ||
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O cov-analysis-linux64.tar.gz | ||
mkdir cov-analysis-linux64 | ||
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 | ||
env: | ||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} | ||
|
||
- name: Prepare build | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. | ||
- name: Build with cov-build | ||
run: | | ||
export PATH=${{ runner.workspace }}/cov-analysis-linux64/bin:$PATH | ||
cd build | ||
cov-build --dir ${{ runner.workspace }}/cov-int make -j2 | ||
- name: Submit the result to Coverity Scan | ||
run: | | ||
cd ${{ runner.workspace }} | ||
tar czvf forgottenserver.tgz cov-int | ||
du -hs forgottenserver.tgz | ||
curl \ | ||
--form project=$COVERITY_PROJECT \ | ||
--form token=$TOKEN \ | ||
--form email=$COVERITY_EMAIL \ | ||
--form [email protected] \ | ||
--form version=$GITHUB_SHA \ | ||
https://scan.coverity.com/builds?project=$COVERITY_PROJECT | ||
env: | ||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
name: Lua syntax check | ||
|
||
on: [pull_request] | ||
on: | ||
pull_request: | ||
paths: | ||
- data/**.lua | ||
push: | ||
paths: | ||
- data/**.lua | ||
|
||
jobs: | ||
build: | ||
|
||
luac: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: leafo/gh-actions-lua@v5 | ||
- uses: leafo/gh-actions-lua@v5 | ||
|
||
- name: Test Lua syntax | ||
run: find data/ -name '*.lua' -print0 | xargs -0 -n1 luac -p | ||
- name: Test Lua syntax | ||
run: find data/ -name '*.lua' -print0 | xargs -0 -n1 luac -p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: XML syntax check | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- data/**.xml | ||
push: | ||
paths: | ||
- data/**.xml | ||
|
||
jobs: | ||
luac: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install xmllint | ||
run: apt-get install -y libxml2-utils | ||
|
||
- name: Test XML syntax | ||
run: find data/ -name '*.xml' -print0 | xargs -0 -n1 xmllint --noout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.