Various minor fixes in nightly pipeline
This commit is contained in:
parent
ad5b43f6db
commit
5ce71506c8
@ -65,7 +65,7 @@ class TestFileTransmission(BaseTest):
|
|||||||
shutil.rmtree(self.tdir)
|
shutil.rmtree(self.tdir)
|
||||||
self.responses = []
|
self.responses = []
|
||||||
if self.orig_home is None:
|
if self.orig_home is None:
|
||||||
os.environ.pop('HOME')
|
os.environ.pop('HOME', None)
|
||||||
else:
|
else:
|
||||||
os.environ['HOME'] = self.orig_home
|
os.environ['HOME'] = self.orig_home
|
||||||
|
|
||||||
|
|||||||
20
publish.py
20
publish.py
@ -3,7 +3,6 @@
|
|||||||
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import mimetypes
|
import mimetypes
|
||||||
@ -34,7 +33,7 @@ if ap is not None:
|
|||||||
appname = ap.group(1)
|
appname = ap.group(1)
|
||||||
|
|
||||||
ALL_ACTIONS = 'man html build tag sdist upload website'.split()
|
ALL_ACTIONS = 'man html build tag sdist upload website'.split()
|
||||||
NIGHTLY_ACTIONS = 'man html build upload_nightly'
|
NIGHTLY_ACTIONS = 'man html build upload_nightly'.split()
|
||||||
|
|
||||||
|
|
||||||
def call(*cmd: str, cwd: Optional[str] = None) -> None:
|
def call(*cmd: str, cwd: Optional[str] = None) -> None:
|
||||||
@ -119,6 +118,9 @@ def run_website(args: Any) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def sign_file(path: str) -> None:
|
def sign_file(path: str) -> None:
|
||||||
|
dest = path + '.sig'
|
||||||
|
with suppress(FileNotFoundError):
|
||||||
|
os.remove(dest)
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
os.environ['PENV'] + '/gpg-as-kovid', '--output', path + '.sig',
|
os.environ['PENV'] + '/gpg-as-kovid', '--output', path + '.sig',
|
||||||
'--detach-sig', path
|
'--detach-sig', path
|
||||||
@ -247,14 +249,7 @@ class GitHub(Base): # {{{
|
|||||||
r = self.requests.delete(asset_url.format(existing_assets[fname]))
|
r = self.requests.delete(asset_url.format(existing_assets[fname]))
|
||||||
if r.status_code != 204:
|
if r.status_code != 204:
|
||||||
self.fail(r, 'Failed to delete %s from GitHub' % fname)
|
self.fail(r, 'Failed to delete %s from GitHub' % fname)
|
||||||
purl = url_base + release["id"]
|
|
||||||
now = str(datetime.datetime.utcnow()).split('.')[0] + ' UTC'
|
|
||||||
with open('.git/refs/heads/master') as f:
|
|
||||||
commit = f.read().strip()
|
|
||||||
self.patch(purl, 'Failed to update nightly release description',
|
|
||||||
body=f'Nightly release, generated on: {now} from commit: {commit}')
|
|
||||||
for path, desc in self.files.items():
|
for path, desc in self.files.items():
|
||||||
self.info('')
|
|
||||||
fname = os.path.basename(path)
|
fname = os.path.basename(path)
|
||||||
if self.is_nightly:
|
if self.is_nightly:
|
||||||
fname = fname.replace(version, 'nightly')
|
fname = fname.replace(version, 'nightly')
|
||||||
@ -379,6 +374,7 @@ def files_for_upload() -> Dict[str, str]:
|
|||||||
for f in files:
|
for f in files:
|
||||||
if not os.path.exists(f):
|
if not os.path.exists(f):
|
||||||
raise SystemExit(f'The release artifact {f} does not exist')
|
raise SystemExit(f'The release artifact {f} does not exist')
|
||||||
|
return files
|
||||||
|
|
||||||
|
|
||||||
def run_upload(args: Any) -> None:
|
def run_upload(args: Any) -> None:
|
||||||
@ -389,6 +385,8 @@ def run_upload(args: Any) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def run_upload_nightly(args: Any) -> None:
|
def run_upload_nightly(args: Any) -> None:
|
||||||
|
subprocess.check_call(['git', 'tag', '-f', 'nightly'])
|
||||||
|
subprocess.check_call(['git', 'push', 'origin', 'nightly', '-f'])
|
||||||
gd = get_github_data()
|
gd = get_github_data()
|
||||||
files = files_for_upload()
|
files = files_for_upload()
|
||||||
gh = GitHub(files, appname, 'nightly', gd['username'], gd['password'])
|
gh = GitHub(files, appname, 'nightly', gd['username'], gd['password'])
|
||||||
@ -458,7 +456,7 @@ def main() -> None:
|
|||||||
'action',
|
'action',
|
||||||
default='all',
|
default='all',
|
||||||
nargs='?',
|
nargs='?',
|
||||||
choices=list(ALL_ACTIONS) + ['all'],
|
choices=list(ALL_ACTIONS) + ['all', 'upload_nightly'],
|
||||||
help='The action to start with')
|
help='The action to start with')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
require_penv()
|
require_penv()
|
||||||
@ -469,6 +467,8 @@ def main() -> None:
|
|||||||
require_git_master()
|
require_git_master()
|
||||||
if args.action == 'all':
|
if args.action == 'all':
|
||||||
actions = list(ALL_ACTIONS)
|
actions = list(ALL_ACTIONS)
|
||||||
|
elif args.action == 'upload_nightly':
|
||||||
|
actions = ['upload_nightly']
|
||||||
else:
|
else:
|
||||||
idx = ALL_ACTIONS.index(args.action)
|
idx = ALL_ACTIONS.index(args.action)
|
||||||
actions = ALL_ACTIONS[idx:]
|
actions = ALL_ACTIONS[idx:]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user