workflows: add tests.yml

This commit is contained in:
nillerusr 2022-08-17 11:22:05 +03:00
parent e9145519ec
commit d52fabd0eb
6 changed files with 109 additions and 0 deletions

42
.github/workflows/tests.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Tests
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
tests-linux-i386:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Run tests linux-i386
run: |
scripts/tests-ubuntu-i386.sh
tests-linux-amd64:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Run tests linux-amd64
run: |
scripts/tests-ubuntu-amd64.sh
tests-windows-i386:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Run tests windows-i386
run: |
git submodule init && git submodule update
./waf.bat configure -T release --tests --prefix=out/
./waf.bat install
cd out
$env:Path = "bin";
./unittest.exe

10
scripts/tests-ubuntu-amd64.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
git submodule init && git submodule update
sudo apt-get update
sudo apt-get install -f -y gdb libopenal-dev g++-multilib gcc-multilib libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev libedit-dev
./waf configure -T release --disable-warns --tests --prefix=out/ --64bits $* &&
./waf install &&
cd out &&
LD_LIBRARY_PATH=. ./unittest

11
scripts/tests-ubuntu-i386.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
git submodule init && git submodule update
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -f -y libopenal-dev:i386 g++-multilib gcc-multilib libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 libfontconfig1-dev:i386 libcurl4-gnutls-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386 libbz2-dev:i386 libedit-dev:i386
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T release --disable-warns --tests --prefix=out/ $* &&
./waf install &&
cd out &&
LD_LIBRARY_PATH=. ./unittest

44
unitlib/wscript Executable file
View file

@ -0,0 +1,44 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'unitlib'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES', ['UNITLIB_DLL_EXPORT=1'])
def build(bld):
source = [
'unitlib.cpp'
]
includes = [
'.',
'../',
'../public',
'../public/tier1',
'../public/tier0',
'../common'
]
defines = []
libs = []
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

View file

@ -40,6 +40,7 @@ SpewRetval_t UnitTestSpew( SpewType_t type, char const *pMsg )
break; break;
} }
printf( "%s", pMsg ); printf( "%s", pMsg );
fflush(stdout);
if ( Sys_IsDebuggerPresent() ) if ( Sys_IsDebuggerPresent() )
return ( type == SPEW_ASSERT || type == SPEW_ERROR ) ? SPEW_DEBUGGER : SPEW_CONTINUE; return ( type == SPEW_ASSERT || type == SPEW_ERROR ) ? SPEW_DEBUGGER : SPEW_CONTINUE;

View file

@ -23,6 +23,7 @@ def build(bld):
if bld.env.DEST_OS != 'win32': if bld.env.DEST_OS != 'win32':
libs += [ 'DL', 'LOG' ] libs += [ 'DL', 'LOG' ]
else: else:
bld.env.LDFLAGS += ['/subsystem:console']
libs += ['USER32', 'SHELL32'] libs += ['USER32', 'SHELL32']
install_path = bld.env.BINDIR install_path = bld.env.BINDIR