Skip to content

Fix linux cmake build #18

Fix linux cmake build

Fix linux cmake build #18

Workflow file for this run

name: Build and test pull request
on: [pull_request]
jobs:
Windows:
name: Build windows version
runs-on: windows-2022
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup MSBuild and add to PATH
uses: microsoft/[email protected]
id: setup_msbuild
- name: Run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: x86-windows-static
vcpkgGitCommitId: 3b3bd424827a1f7f4813216f6b32b6c61e386b2e
vcpkgArguments: >
boost-iostreams boost-asio boost-beast boost-system boost-variant boost-lockfree boost-process boost-program-options boost-uuid boost-filesystem
luajit glew physfs openal-soft libogg libvorbis zlib libzip bzip2 openssl liblzma
- name: Integrate vcpkg
run: |
${{ runner.workspace }}\vcpkg\vcpkg integrate install
- name: Compile
timeout-minutes: 60
run: |
cd vc16
MSBuild /property:Configuration=DirectX /p:BUILD_REVISION=${{github.run_number}}
MSBuild /property:Configuration=OpenGL /p:BUILD_REVISION=${{github.run_number}}
- name: Upload binaries
uses: 'actions/upload-artifact@v2'
with:
name: Binaries
path: |
otclient_gl.exe
otclient_dx.exe
lib.7z
if-no-files-found: error
Android:
name: Build android version
runs-on: windows-2019
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup MSBuild and add to PATH
uses: microsoft/[email protected]
id: setup_msbuild
- name: Create data.zip for android
run: |
powershell -ExecutionPolicy Bypass -File .\create_android_assets.ps1
- name: Decompress android libs
run: |
7z x android_libs.7z -aoa -oC:\android
- name: Install android
run: |
$sdkRoot = "C:\Android\android-sdk"
$sdkManager = "$sdkRoot\cmdline-tools\latest\bin\sdkmanager.bat"
Install-AndroidSDKPackages -AndroidSDKManagerPath $sdkManager `
-AndroidSDKRootPath $sdkRoot `
-AndroidPackages "ndk;21.4.7075529"
- name: Build for android
timeout-minutes: 25
run: |
cd android
$env:VS_NdkRoot="C:\Android\android-sdk\ndk\21.4.7075529"
MSBuild.exe /p:Configuration=Release /p:Platform="ARM64" /p:BUILD_REVISION=${{github.run_number}}
- name: Upload binaries
uses: 'actions/upload-artifact@v2'
with:
name: Binaries
path: |
otclientv8.apk
if-no-files-found: error
Mac:
name: Build mac os version
runs-on: macos-11
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: MacOS - install physfs pkgconfig luajit xquartz
run: brew install physfs pkgconfig luajit xquartz
- name: Run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: >
boost-iostreams boost-asio boost-system boost-variant boost-lockfree boost-beast glew
boost-filesystem boost-uuid libogg libvorbis zlib opengl libzip openal-soft bzip2
boost-process openssl
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: x64-osx
vcpkgGitCommitId: 761c81d43335a5d5ccc2ec8ad90bd7e2cbba734e
- name: Build with CMake
uses: lukka/run-cmake@v3
with:
buildDirectory: ${{ runner.workspace }}/build
cmakeAppendedArgs: '-G Ninja -DCMAKE_BUILD_TYPE="Release" -DVERSION=${{github.run_number}} -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing"'
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
useVcpkgToolchainFile: true
- name: Change name
run: |
mv '${{ runner.workspace }}/build/otclient' '${{ runner.workspace }}/build/otclient_mac'
- name: Upload otclient
uses: actions/upload-artifact@v2
with:
name: Binaries
path: |
${{ runner.workspace }}/build/otclient_mac
if-no-files-found: error
Linux:
name: Build linux version
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: Ubuntu - install opengl lua5.1 luajit
run: sudo apt update && sudo apt install -y libglew-dev liblua5.1-0-dev libluajit-5.1-dev
- name: Run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: >
boost-iostreams boost-asio boost-system boost-variant boost-lockfree boost-beast glew
boost-filesystem boost-uuid libogg libvorbis zlib opengl libzip openal-soft bzip2
boost-process openssl physfs
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
vcpkgTriplet: x64-linux
vcpkgGitCommitId: 761c81d43335a5d5ccc2ec8ad90bd7e2cbba734e
- name: Build with CMake
uses: lukka/run-cmake@v3
with:
buildDirectory: ${{ runner.workspace }}/build
cmakeAppendedArgs: '-G Ninja -DCMAKE_BUILD_TYPE="Release" -DVERSION=${{github.run_number}}'
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
useVcpkgToolchainFile: true
- name: Change name
run: |
mv '${{ runner.workspace }}/build/otclient' '${{ runner.workspace }}/build/otclient_linux'
- name: Upload otclient
uses: actions/upload-artifact@v2
with:
name: Binaries
path: |
${{ runner.workspace }}/build/otclient_linux
if-no-files-found: error
Test:
name: Test
runs-on: windows-2019
needs: [Windows, Android, Mac, Linux]
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: Binaries
- name: Run tests
timeout-minutes: 10
run: |
7z x tests.7z -aoa
$process = (Start-Process -Wait -PassThru otclient_dx.exe --test)
Get-Content otclientv8.log
if ($process.ExitCode -ne 0) {
throw "Invalid exit code: " + $process.ExitCode;
}
- name: Upload otclientv8.log
uses: actions/upload-artifact@v2
with:
path: otclientv8.log
name: Download-otclientv8.log
if-no-files-found: error
- name: Copy screenshots
run: |
$location = Get-Location
$pillowScript = @"
from PIL import Image
import glob
for file in glob.glob('*.png'):
Image.open(file).convert('RGB').save(
file[:-3] + 'jpg',
quality=50,
)
"@
cd $env:appdata\otclientv8\otclientv8
pip3 install pillow
python3 -c $pillowScript
cd $location
mkdir screenshots
Get-ChildItem $env:appdata\otclientv8\otclientv8 -Filter *.jpg `
| Copy-Item -Destination screenshots -Force -PassThru
- name: Upload screenshot
uses: actions/upload-artifact@v2
with:
path: screenshots
name: Download-screenshots
- name: Cleanup things
run: |
Remove-Item 'data\things' -Recurse
- name: Upload otclient
uses: actions/upload-artifact@v2
with:
name: Download-otclientv8
path: |
otclient_gl.exe
otclient_dx.exe
otclientv8.apk
otclient_mac
otclient_linux
*.dll
data
modules
layouts
mods
init.lua
if-no-files-found: error