Skip to content

Commit

Permalink
Convenience command to upload CI bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Aug 12, 2020
1 parent 31191fd commit 36bd76d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import subprocess
import sys
import tarfile
import shutil
from urllib.request import urlopen

is_bundle = os.environ.get('KITTY_BUNDLE') == '1'
Expand Down Expand Up @@ -43,7 +44,7 @@ def install_deps():


def build_kitty():
python = 'python3' if is_bundle else sys.executable
python = shutil.which('python3') if is_bundle else sys.executable
cmd = '{} setup.py build --verbose'.format(python)
if os.environ.get('KITTY_SANITIZE') == '1':
cmd += ' --debug --sanitize'
Expand Down Expand Up @@ -85,8 +86,8 @@ def install_bundle():
cwd = os.getcwd()
os.makedirs(SW)
os.chdir(SW)
with urlopen('https://download.calibre-ebook.com/travis/kitty/{}.tar.xz'.format(
'osx' if is_macos else 'linux-64')) as f:
with urlopen('https://download.calibre-ebook.com/ci/kitty/{}-64.tar.xz'.format(
'macos' if is_macos else 'linux')) as f:
data = f.read()
with tarfile.open(fileobj=io.BytesIO(data), mode='r:xz') as tf:
tf.extractall()
Expand Down
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ def option_parser() -> argparse.ArgumentParser: # {{{
'action',
nargs='?',
default=Options.action,
choices='build test linux-package kitty.app linux-freeze macos-freeze build-launcher clean'.split(),
choices='build test linux-package kitty.app linux-freeze macos-freeze build-launcher clean export-ci-bundles'.split(),
help='Action to perform (default is build)'
)
p.add_argument(
Expand Down Expand Up @@ -1180,6 +1180,12 @@ def main() -> None:
build(args)
package(args, bundle_type='macos-package')
print('kitty.app successfully built!')
elif args.action == 'export-ci-bundles':
cmd = [sys.executable, '../bypy', 'export']
dest = ['download.calibre-ebook.com:/srv/download/ci/kitty']
subprocess.check_call(cmd + ['linux'] + dest)
subprocess.check_call(cmd + ['macos'] + dest)
subprocess.check_call(cmd + ['linux', '32'] + dest)


if __name__ == '__main__':
Expand Down

0 comments on commit 36bd76d

Please sign in to comment.