1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-04-27 19:15:07 +00:00

Use github action as ci test.

This commit is contained in:
ly1217 2020-01-13 18:55:55 -08:00
parent 28223c17a3
commit 74cd4594d6
7 changed files with 60 additions and 59 deletions

20
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Seafile CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: actions/setup-python@v1
with:
python-version: "3.6"
- name: install dependencies and test
run: |
cd $GITHUB_WORKSPACE
./ci/install-deps.sh
./ci/run.py

View File

@ -1,40 +0,0 @@
sudo: false
# Must set language to python so we can install custom python pacakges in
# docker-based travis builds
language: python
python:
- "3.7"
services:
- mysql
compiler:
- gcc
addons:
apt:
packages:
- valac
- uuid-dev
- libevent-dev
- libarchive-dev
- intltool
- libjansson-dev
- libonig-dev
- libfuse-dev
- net-tools
cache:
directories:
- "$HOME/.cache/pip"
- "$HOME/.ccache"
before_install:
- ccache -s
- export PATH=/usr/lib/ccache:${PATH}
install:
- "./ci/install-deps.sh"
- pip install future
script:
- "./ci/run.py"
notifications:
slack:
rooms:
secure: 3H6mh5PPPKo0wuwzZybDwnHOya0/IiW8jn/g9ZUFna5P5IqmuuFacZi+lS5Ffgrv/vRYbv9ebjDvIApk2CDc0KzA2vUwr79BjlfPqm1buf75dPf1aINhNjMT1g16afyxciMbdV5QtzSoiyYn+P4026SU40jmJXGL2u/O01HH/dF8Aw8/rpWjhZp1PjhRC40iilVe/q38E9biGsi9lKzJVXumhm3IYyZLsH7aqr2rTg67U1j2bB8OwTaJx4vZdpf6gxKLpwrumkLT1lNFvhOYieuxqNvBw752bB++FImswCwZ2t9ejX2jW1GjTdIJ1FpkHEVF2cz9AeRL5xeBz4bHtG3490PpfqcPLjQ39MI/FP6QRupAi0EUufbHpfx30kdqqBEyztcF66vR4hA42uDopIoF0HIIFyzgTnmN5SKmyhmOaE+hmfgWNtCm79ZYEx/PB8BvUyR2IV6UvQy2kHznNk8UnDnO2shP/2sOn3IUvZQ99y0UUk5LmJMQNOCiB31N1AFESbVKzAqR4ZKN+5K7CwEUQ1uaJgMmwuutrpgR+x6QvN3+zPHiLLunx6zTAJW6PWiHx5+Gxzt2Xi8iEtsmBOWu4o5kvAkjFMtYlzgd+12waQm4HpZaJ+xMbnZEG0jR3CUn7pXjKZhTxiFgXunYkalKWIIITFF5YUWgQJVrfng=
on_success: change
on_failure: always

View File

@ -8,11 +8,9 @@ SETUP_DIR=${TESTS_DIR}/ci
cd $SETUP_DIR
pip install -r requirements.txt
sudo apt-get update
sudo apt-get install -y intltool libarchive-dev libcurl4-openssl-dev libevent-dev \
libfuse-dev libglib2.0-dev libjansson-dev libmysqlclient-dev libonig-dev \
sqlite3 libsqlite3-dev libtool net-tools uuid-dev valac mysql-client
# download precompiled libevhtp
# TODO(lins05): we should consider build from source with https://github.com/criticalstack/libevhtp in the future
libevhtp_bin=libevhtp-bin_1.2.0.tar.gz
wget https://dl.bintray.com/lins05/generic/libevhtp-bin/$libevhtp_bin
# tar xvf $libevhtp_bin --strip-components=3 -C /usr
tar xf $libevhtp_bin -C $HOME
pip install -r requirements.txt

View File

@ -3,3 +3,4 @@ requests>=2.8.0
pytest>=3.3.2
backports.functools_lru_cache>=1.4
tenacity>=4.8.0
future

View File

@ -18,14 +18,14 @@ import termcolor
from serverctl import ServerCtl
from utils import (
cd, chdir, debug, green, info, lru_cache, mkdirs, on_travis, red,
cd, chdir, debug, green, info, lru_cache, mkdirs, on_github_actions, red,
setup_logging, shell, warning
)
logger = logging.getLogger(__name__)
TOPDIR = abspath(join(os.getcwd(), '..'))
if on_travis():
if on_github_actions():
PREFIX = expanduser('~/opt/local')
else:
PREFIX = os.environ.get('SEAFILE_INSTALL_PREFIX', '/usr/local')
@ -53,7 +53,9 @@ def make_build_env():
_env_add('LDFLAGS', '-L%s' % join(PREFIX, 'lib64'), seperator=' ')
_env_add('PATH', join(PREFIX, 'bin'))
_env_add('PYTHONPATH', join(PREFIX, 'lib/python3.7/site-packages'))
if on_github_actions():
_env_add('PYTHONPATH', join(os.environ.get('RUNNER_TOOL_CACHE'), 'Python/3.6.9/x64/lib/python3.6/site-packages'))
_env_add('PYTHONPATH', join(PREFIX, 'lib/python3.6/site-packages'))
_env_add('PKG_CONFIG_PATH', join(PREFIX, 'lib', 'pkgconfig'))
_env_add('PKG_CONFIG_PATH', join(PREFIX, 'lib64', 'pkgconfig'))
_env_add('PKG_CONFIG_PATH', libsearpc_dir)
@ -157,18 +159,38 @@ class SeafileServer(Project):
def __init__(self):
super(SeafileServer, self).__init__('seafile-server')
class Libevhtp(Project):
def __init__(self):
super(Libevhtp, self).__init__('libevhtp')
def branch(self):
return 'master'
@chdir
def compile_and_install(self):
cmds = [
'cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF',
'make',
'sudo make install',
'sudo ldconfig',
]
for cmd in cmds:
shell(cmd)
def fetch_and_build():
libsearpc = Libsearpc()
libevhtp = Libevhtp()
ccnet = CcnetServer()
seafile = SeafileServer()
libsearpc.clone()
libsearpc.compile_and_install()
libevhtp.clone()
ccnet.clone()
ccnet.compile_and_install()
libsearpc.compile_and_install()
libevhtp.compile_and_install()
ccnet.compile_and_install()
seafile.compile_and_install()
@ -184,9 +206,9 @@ def main():
mkdirs(INSTALLDIR)
os.environ.update(make_build_env())
args = parse_args()
if on_travis() and not args.test_only:
if on_github_actions() and not args.test_only:
fetch_and_build()
if on_travis():
if on_github_actions():
dbs = ('sqlite3', 'mysql')
else:
dbs = ('sqlite3',)

View File

@ -167,7 +167,7 @@ connection_charset = utf8
ccnet_sql_path = join(self.sql_dir, 'mysql', 'ccnet.sql')
seafile_sql_path = join(self.sql_dir, 'mysql', 'seafile.sql')
sql = f'USE ccnet; source {ccnet_sql_path}; USE seafile; source {seafile_sql_path};'.encode()
shell('mysql -u root', inputdata=sql, wait=False)
shell('sudo mysql -u root -proot', inputdata=sql, wait=False)
else:
config_sql_path = join(self.sql_dir, 'sqlite', 'config.sql')
groupmgr_sql_path = join(self.sql_dir, 'sqlite', 'groupmgr.sql')
@ -257,4 +257,4 @@ GRANT ALL PRIVILEGES ON `ccnet`.* to `seafile`@localhost;
GRANT ALL PRIVILEGES ON `seafile`.* to `seafile`@localhost;
'''
shell('mysql -u root', inputdata=sql)
shell('sudo mysql -u root -proot', inputdata=sql)

View File

@ -95,8 +95,8 @@ def mkdirs(*paths):
if not exists(path):
os.mkdir(path)
def on_travis():
return 'TRAVIS_BUILD_NUMBER' in os.environ
def on_github_actions():
return 'GITHUB_ACTIONS' in os.environ
@contextmanager
def cd(path):