From c388500dfb531c5d6257fc5beb7de7eb74849d71 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 5 Sep 2019 11:01:05 +0530 Subject: [PATCH] Work on CI --- README.md | 3 +-- azure-pipelines.yml | 38 ++++++++++++++++++++++++++++---------- setup/unix-ci.py | 37 +++++++++++++------------------------ 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index c133b662a8..47cdd71ba5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 007e8fb554..e255d5853a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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' diff --git a/setup/unix-ci.py b/setup/unix-ci.py index 6d046bb0f8..27359b47e0 100644 --- a/setup/unix-ci.py +++ b/setup/unix-ci.py @@ -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')