From 9c07cc7e82f478d48c4e6a767e6b1bf58642adb0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Oct 2019 19:18:10 +0530 Subject: [PATCH] Use GitHub Actions rather than Azure Pipelines --- .github/workflows/ci.yml | 61 ++++++++++++++++++++ README.md | 2 +- azure-pipelines.yml | 117 --------------------------------------- setup/unix-ci.py | 7 +++ 4 files changed, 69 insertions(+), 118 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..68760d339f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: Continuous Integration +on: push + +jobs: + test: + name: Test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-2016] + steps: + - name: Checkout source code + uses: actions/checkout@master + with: + fetch-depth: 10 + + - name: Set up Python + uses: actions/setup-python@master + with: + python-version: 3.7 + + - name: Install calibre dependencies + run: + python setup/unix-ci.py install + + - name: Bootstrap calibre + run: + python setup/unix-ci.py bootstrap + + - name: Test calibre + run: + python setup/unix-ci.py test + + archtest: + name: Test on Arch + runs-on: ubuntu-latest + container: + image: 'archlinux/base:latest' + env: + CI: 'true' + CALIBRE_PY3_PORT: '1' + steps: + - name: Install calibre dependencies + run: | + set -xe + useradd -m ci + pacman -Syu --noconfirm + pacman -S --noconfirm --needed base-devel sudo git sip chmlib icu jxrlib hunspell libmtp libusbx libwmf optipng podofo python-apsw python-beautifulsoup4 python-cssselect python-css-parser python-dateutil python-dbus python-dnspython python-dukpy python-feedparser python-html2text python-html5-parser python-lxml python-markdown python-mechanize python-msgpack python-netifaces python-unrardll python-pillow python-psutil python-pygments python-pyqt5 python-regex python-zeroconf python-pyqtwebengine qt5-x11extras qt5-svg qt5-imageformats udisks2 + + - name: Checkout source code + uses: actions/checkout@master + with: + fetch-depth: 10 + + - name: Bootstrap calibre + run: | + chown -R ci:users $GITHUB_WORKSPACE + runuser -u ci -- python setup.py bootstrap --ephemeral + + - name: Test calibre + run: runuser -u ci -- python setup.py test diff --git a/README.md b/README.md index 954e4824e2..30a47dc27c 100644 --- a/README.md +++ b/README.md @@ -10,7 +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://dev.azure.com/divok/calibre/_apis/build/status/kovidgoyal.calibre?branchName=master)](https://dev.azure.com/divok/calibre/_build/latest?definitionId=1&branchName=master) +![Build Status](https://github.com/kovidgoyal/calibre/workflows/Continuous%20Integration/badge.svg) ## Screenshots diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index b98351b188..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,117 +0,0 @@ -# https://aka.ms/yaml -trigger: - branches: - include: - - '*' - -jobs: - -- job: 'Python3' - pool: - vmImage: 'ubuntu-latest' - container: - image: 'archlinux/base:latest' - # See https://github.com/Microsoft/azure-pipelines-agent/issues/2043 - # for why we need this hack to get root in the container - options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro" - - steps: - - script: | - set -xe - /tmp/docker exec -t -u 0 ci-container sh -c "pacman -Syu --noconfirm" - /tmp/docker exec -t -u 0 ci-container \ - sh -c "pacman -S --noconfirm --needed base-devel sudo git sip chmlib icu jxrlib hunspell libmtp libusbx libwmf optipng podofo python-apsw python-beautifulsoup4 python-cssselect python-css-parser python-dateutil python-dbus python-dnspython python-dukpy python-feedparser python-html2text python-html5-parser python-lxml python-markdown python-mechanize python-msgpack python-netifaces python-unrardll python-pillow python-psutil python-pygments python-pyqt5 python-regex python-zeroconf python-pyqtwebengine qt5-x11extras qt5-svg qt5-imageformats udisks2" - displayName: 'Install calibre dependencies' - - - checkout: self - fetchDepth: 10 - - - script: | - python setup.py bootstrap --ephemeral - displayName: 'Bootstrap calibre' - env: { 'CALIBRE_PY3_PORT': '1' } - - - script: | - python setup.py test - displayName: 'Test calibre' - env: { 'CALIBRE_PY3_PORT': '1' } - - -- job: 'Linux' - pool: - vmImage: 'ubuntu-latest' - - steps: - - checkout: self - fetchDepth: 10 - - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - architecture: 'x64' - - - script: | - sudo apt-get install -y gettext libgl1-mesa-dev - 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' - -- job: 'macOS' - pool: - vmImage: 'macos-latest' - - steps: - - checkout: self - fetchDepth: 10 - - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - architecture: 'x64' - - - 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' - -- job: 'Windows' - pool: - vmImage: 'vs2017-win2016' - - steps: - - checkout: self - fetchDepth: 10 - - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - architecture: 'x64' - - - script: | - python setup/win-ci.py install - displayName: 'Install calibre dependencies' - - - script: | - python setup/win-ci.py bootstrap - displayName: 'Bootstrap calibre' - - - script: | - python setup/win-ci.py test - displayName: 'Test calibre' diff --git a/setup/unix-ci.py b/setup/unix-ci.py index 8c7db018ad..293c1bfdda 100644 --- a/setup/unix-ci.py +++ b/setup/unix-ci.py @@ -13,6 +13,7 @@ from tempfile import NamedTemporaryFile _plat = sys.platform.lower() ismacos = 'darwin' in _plat +iswindows = 'win32' in _plat or 'win64' in _plat def setenv(key, val): @@ -92,6 +93,10 @@ def run_python(*args): def main(): + if iswindows: + import runpy + m = runpy.run_path('setup/win-ci.py') + return m['main']() action = sys.argv[1] if action == 'install': run('sudo', 'mkdir', '-p', SW) @@ -101,6 +106,8 @@ def main(): download_and_decompress( 'https://download.calibre-ebook.com/ci/calibre/{}.tar.xz'.format(tball), SW ) + if not ismacos: + run('sudo', 'apt-get', 'install', '-y', 'gettext', 'libgl1-mesa-dev') elif action == 'bootstrap': install_env()