Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CMake presets and vcpkg manifest in workflows #4376

Merged
merged 17 commits into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,40 @@ on:
- cmake/**
- src/**
- CMakeLists.txt
- CMakePresets.json

pull_request:
paths:
- cmake/**
- src/**
- CMakeLists.txt
- CMakePresets.json

jobs:
build-ubuntu:
runs-on: ubuntu-20.04
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Get latest CMake
# Using 'latest' branch, the latest CMake is installed.
uses: lukka/get-cmake@latest

- name: Install dependencies
run: >
sudo apt-get update &&
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
sudo apt update -q &&
sudo apt install -yq build-essential libluajit-5.1-dev libmysqlclient-dev
libboost-system-dev libboost-iostreams-dev
libpugixml-dev libcrypto++-dev libfmt-dev

- name: Build with cmake
uses: ashutoshvarma/action-cmake-build@master
uses: lukka/run-cmake@v10
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
buildPreset: ninja
configurePreset: ninja

- name: Upload artifact binary
uses: actions/upload-artifact@v3
with:
name: ubuntu-tfs-amd64-${{ github.sha }}
path: ${{ runner.workspace }}/build/tfs
166 changes: 34 additions & 132 deletions .github/workflows/build-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,193 +10,95 @@ on:
- cmake/**
- src/**
- CMakeLists.txt
- CMakePresets.json
- vcpkg.json

pull_request:
paths:
- cmake/**
- src/**
- CMakeLists.txt
- CMakePresets.json
- vcpkg.json

jobs:
unix:
name: ${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}
build-vcpkg:
name: ${{ matrix.name }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
name: [ubuntu-gcc, ubuntu-clang, macos-clang]
name: [ubuntu, ubuntu-clang, macos-clang, windows-msvc]
buildtype: [Debug, Release]
luajit: [on, off]
include:
- name: ubuntu-gcc
- name: ubuntu
os: ubuntu
cxx: g++
cc: gcc
triplet: x64-linux
packages: >
boost-asio boost-iostreams boost-system boost-filesystem boost-variant boost-lockfree
lua libmariadb pugixml cryptopp fmt
- name: ubuntu-clang
os: ubuntu
cxx: clang++
cc: clang
triplet: x64-linux
packages: >
boost-asio boost-iostreams boost-system boost-filesystem boost-variant boost-lockfree
lua libmariadb pugixml cryptopp fmt
- name: macos-clang
os: macos
cxx: clang++
cc: clang
triplet: x64-osx
packages: >
boost-asio boost-iostreams boost-system boost-filesystem boost-variant boost-lockfree
lua libmariadb pugixml cryptopp fmt
- name: windows-msvc
os: windows
exclude:
- name: ubuntu-clang
buildtype: Release
- name: ubuntu-clang
luajit: off
- name: macos-clang
luajit: off
- name: windows-msvc
luajit: off

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- 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: Enable LuaJIT
if: ${{ matrix.luajit }} == "on"
run: echo "VCPKG_FEATURE_FLAGS=luajit" >> $GITHUB_ENV

- name: Set Environment vars
- name: Set clang as compiler
if: ${{ endsWith(matrix.name, 'clang') }}
run: |
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV

- name: Run vcpkg
uses: lukka/run-vcpkg@v7
uses: lukka/run-vcpkg@v11
with:
vcpkgArguments: ${{ matrix.packages }}
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: ${{ matrix.triplet }}
appendedCacheKey: ${{ matrix.name }}${{ matrix.buildtype }}${{ matrix.luajit }}
vcpkgGitCommitId: 5568f110b509a9fd90711978a7cb76bae75bb092
vcpkgGitCommitId: 5b1214315250939257ef5d62ecdcbca18cf4fb1c

- name: Build with CMake
uses: lukka/run-cmake@v3
uses: lukka/run-cmake@v10
with:
useVcpkgToolchainFile: true
buildDirectory: ${{ runner.workspace }}/build
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeAppendedArgs: '-G Ninja -DCMAKE_BUILD_TYPE="${{ matrix.buildtype }}" -DUSE_LUAJIT="${{ matrix.luajit }}"'

- name: dir
run: find $RUNNER_WORKSPACE
shell: bash
buildPreset: ninja-vcpkg
configurePreset: ninja-vcpkg

- name: Upload artifact binary
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: ${{ !startsWith(matrix.os, 'windows') }}
with:
name: tfs-${{ matrix.name }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}-${{ github.sha }}
path: ${{ runner.workspace }}/build/tfs

- 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.name }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}-${{ github.sha }}
path: ${{ github.workspace }}

windows:
name: ${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.buildtype }}-luajit=on
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
max-parallel: 8
matrix:
name: [windows-msvc]
buildtype: [Debug, Release]
include:
- name: windows-msvc
os: windows
cxx: cl.exe
cc: cl.exe
triplet: x64-windows
packages: >
boost-asio boost-iostreams boost-system boost-filesystem boost-variant boost-lockfree
lua luajit libmariadb pugixml cryptopp fmt

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get latest CMake
# Using 'latest' branch, the latest CMake is installed.
uses: lukka/get-cmake@latest

- name: Windows - remove C:/mysql*
run: rm -r -fo C:/mysql*

- name: Set Environment vars
run: |
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV

- name: Run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: ${{ matrix.packages }}
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: ${{ matrix.triplet }}
appendedCacheKey: ${{ matrix.name }}${{ matrix.buildtype }}${{ matrix.luajit }}
vcpkgGitCommitId: 5568f110b509a9fd90711978a7cb76bae75bb092

- name: Build with CMake
uses: lukka/run-cmake@v3
with:
useVcpkgToolchainFile: true
buildDirectory: ${{ runner.workspace }}/build
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeAppendedArgs: '-G Ninja -DCMAKE_BUILD_TYPE="${{ matrix.buildtype }}" -DUSE_LUAJIT="on"'

- name: dir
run: find $RUNNER_WORKSPACE
shell: bash

- name: Upload artifact binary (exe)
uses: actions/upload-artifact@v2
with:
name: tfs-${{ matrix.name }}-${{ matrix.buildtype }}-luajit=on-${{ github.sha }}
path: ${{ runner.workspace }}/build/tfs.exe

- name: Upload artifact binary (dlls)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: ${{ startsWith(matrix.os, 'windows') }}
with:
name: tfs-${{ matrix.name }}-${{ matrix.buildtype }}-luajit=on-${{ github.sha }}
path: ${{ runner.workspace }}/build/*.dll
name: tfs-${{ matrix.name }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}-${{ github.sha }}
path: |
${{ runner.workspace }}/build/tfs.exe
${{ runner.workspace }}/build/*.dll

- 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
uses: actions/upload-artifact@v3
with:
name: tfs-${{ matrix.name }}-${{ matrix.buildtype }}-luajit=on-${{ github.sha }}
name: tfs-${{ matrix.name }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}-${{ github.sha }}
path: ${{ github.workspace }}
2 changes: 1 addition & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
check-format:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:

- 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
sudo apt update -q &&
sudo apt install -yq build-essential libluajit-5.1-dev libmysqlclient-dev
libboost-system-dev libboost-iostreams-dev
libpugixml-dev libcrypto++-dev libfmt-dev

- name: Get latest CMake
Expand Down
Loading