Work on CI

This commit is contained in:
Kovid Goyal 2019-09-05 11:01:05 +05:30
parent a344028733
commit c388500dfb
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 42 additions and 36 deletions

View File

@ -10,8 +10,7 @@ reading. It is cross platform, running on Linux, Windows and macOS.
For more information, see the [calibre About page](https://calibre-ebook.com/about)
[![Build Status](https://api.travis-ci.org/kovidgoyal/calibre.svg?branch=master)](https://travis-ci.org/kovidgoyal/calibre)
[![Build status](https://ci.appveyor.com/api/projects/status/github/kovidgoyal/calibre?svg=true&branch=master)](https://ci.appveyor.com/project/kovidgoyal/calibre)
[![Build Status](https://dev.azure.com/kovidgoyal/mechanize/_apis/build/status/python-mechanize.mechanize?branchName=engine)](https://dev.azure.com/kovidgoyal/mechanize/_build/latest?definitionId=1&branchName=engine)
## Screenshots

View File

@ -4,17 +4,35 @@ trigger:
include:
- '*'
exclude:
- master
- 'master'
jobs:
pool:
vmImage: 'ubuntu-latest'
- job: 'Linux'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
steps:
- checkout: self
fetchDepth: 1
- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'
- script: |
sudo apt-get install -y gettext
displayName: 'Install needed OS libs'
- script: |
python3 setup/unix-ci.py install
displayName: 'Install calibre dependencies'
- script: |
python3 setup/unix-ci.py bootstrap
displayName: 'Bootstrap calibre'
- script: |
python3 setup/unix-ci.py test
displayName: 'Test calibre'

View File

@ -12,20 +12,19 @@ import time
from tempfile import NamedTemporaryFile
_plat = sys.platform.lower()
isosx = 'darwin' in _plat
ismacos = 'darwin' in _plat
def setenv(key, val):
os.environ[key] = os.path.expandvars(val)
if isosx:
SWBASE = '/sw'
SW = SWBASE + '/sw'
SWBASE = '/sw'
SW = SWBASE + '/sw'
if ismacos:
def install_env():
# On OS X the frameworks/dylibs contain hard coded paths, so we have to re-create the paths in the VM exactly
setenv('SWBASE', SWBASE)
setenv('SW', SW)
setenv(
@ -35,11 +34,9 @@ if isosx:
setenv('CFLAGS', '-I$SW/include')
setenv('LDFLAGS', '-L$SW/lib')
setenv('QMAKE', '$SW/qt/bin/qmake')
setenv('QT_PLUGIN_PATH', '$SW/qt/plugins')
setenv('CALIBRE_QT_PREFIX', '$SW/qt')
else:
SW = os.path.expanduser('~/sw')
def install_env():
setenv('SW', SW)
setenv('PATH', '$SW/bin:$PATH')
@ -48,7 +45,7 @@ else:
setenv('LD_LIBRARY_PATH', '$SW/qt/lib:$SW/lib')
setenv('PKG_CONFIG_PATH', '$SW/lib/pkgconfig')
setenv('QMAKE', '$SW/qt/bin/qmake')
setenv('QT_PLUGIN_PATH', '$SW/qt/plugins')
setenv('CALIBRE_QT_PREFIX', '$SW/qt')
def run(*args):
@ -89,28 +86,20 @@ def run_python(*args):
def main():
action = sys.argv[1]
if action == 'install':
if isosx:
run('sudo', 'mkdir', '-p', SW)
run('sudo', 'chown', '-R', os.environ['USER'], SWBASE)
tball = 'osx'
else:
tball = 'linux-64'
os.makedirs(SW)
download_and_decompress(
'https://download.calibre-ebook.com/travis/{}.tar.xz'.format(tball), SW
)
run('sudo', 'mkdir', '-p', SW)
run('sudo', 'chown', '-R', os.environ['USER'], SWBASE)
run('npm install --no-optional rapydscript-ng uglify-js regenerator')
print(os.environ['PATH'])
run('which rapydscript')
run('rapydscript --version')
tball = 'macos' if ismacos else 'linux-64'
download_and_decompress(
'https://download.calibre-ebook.com/ci/calibre/{}.tar.xz'.format(tball), SW
)
elif action == 'bootstrap':
install_env()
run_python('setup.py bootstrap --ephemeral')
elif action == 'test':
if isosx:
if ismacos:
os.environ['SSL_CERT_FILE'
] = os.path.abspath('resources/mozilla-ca-certs.pem')