mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-02 11:58:14 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2d4127a31 | ||
|
|
07b6edce12 | ||
|
|
ef7f9ccca1 | ||
|
|
3b296cbcc9 | ||
|
|
f5361cd5ab | ||
|
|
758909efba | ||
|
|
0bc8000f14 | ||
|
|
e62e7e0e6e |
14
jenkins/release.groovy
Normal file
14
jenkins/release.groovy
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
stage('Upload to github')
|
||||||
|
{
|
||||||
|
node('ActiveClientMacosxBuilder') {
|
||||||
|
deleteDir()
|
||||||
|
checkout scm
|
||||||
|
withPythonEnv('/usr/local/bin/python3.7') {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'github_friendsofgalaxy', usernameVariable: 'GITHUB_USERNAME', passwordVariable: 'GITHUB_TOKEN')]) {
|
||||||
|
sh 'pip install -r jenkins/requirements.txt'
|
||||||
|
def version = sh(returnStdout: true, script: 'python setup.py --version').trim()
|
||||||
|
sh "python jenkins/release.py $version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
jenkins/release.py
Normal file
26
jenkins/release.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from galaxy.github.exporter import transfer_repo
|
||||||
|
|
||||||
|
GITHUB_USERNAME = "FriendsOfGalaxy"
|
||||||
|
GITHUB_EMAIL = "friendsofgalaxy@gmail.com"
|
||||||
|
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]
|
||||||
|
GITHUB_REPO_NAME = "galaxy-plugin-api"
|
||||||
|
SOURCE_BRANCH = os.environ["GIT_REFSPEC"]
|
||||||
|
|
||||||
|
GITLAB_USERNAME = "galaxy-client"
|
||||||
|
GITLAB_REPO_NAME = "galaxy-plugin-api"
|
||||||
|
|
||||||
|
def version_provider(_):
|
||||||
|
return sys.argv[1]
|
||||||
|
|
||||||
|
gh_version = transfer_repo(
|
||||||
|
version_provider=version_provider,
|
||||||
|
source_repo_spec="git@gitlab.gog.com:{}/{}.git".format(GITLAB_USERNAME, GITLAB_REPO_NAME),
|
||||||
|
source_include_elements=["src", "tests", "requirements.txt", ".gitignore", "*.md", "pytest.ini"],
|
||||||
|
source_branch=SOURCE_BRANCH,
|
||||||
|
dest_repo_spec="https://{}:{}@github.com/{}/{}.git".format(GITHUB_USERNAME, GITHUB_TOKEN, GITHUB_USERNAME, GITHUB_REPO_NAME),
|
||||||
|
dest_branch="master",
|
||||||
|
dest_user_email=GITHUB_EMAIL,
|
||||||
|
dest_user_name=GITLAB_USERNAME
|
||||||
|
)
|
||||||
1
jenkins/requirements.txt
Normal file
1
jenkins/requirements.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
git+ssh://git@gitlab.gog.com/galaxy-client/github-exporter.git@v0.1
|
||||||
2
setup.py
2
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="galaxy.plugin.api",
|
name="galaxy.plugin.api",
|
||||||
version="0.30",
|
version="0.31",
|
||||||
description="Galaxy python plugin API",
|
description="Galaxy python plugin API",
|
||||||
author='Galaxy team',
|
author='Galaxy team',
|
||||||
author_email='galaxy@gog.com',
|
author_email='galaxy@gog.com',
|
||||||
|
|||||||
@@ -339,24 +339,28 @@ class Plugin():
|
|||||||
if self._achievements_import_in_progress:
|
if self._achievements_import_in_progress:
|
||||||
raise ImportInProgress()
|
raise ImportInProgress()
|
||||||
|
|
||||||
async def import_games_achievements(game_ids):
|
async def import_games_achievements_task(game_ids):
|
||||||
async def import_game_achievements(game_id):
|
|
||||||
try:
|
|
||||||
achievements = await self.get_unlocked_achievements(game_id)
|
|
||||||
self.game_achievements_import_success(game_id, achievements)
|
|
||||||
except Exception as error:
|
|
||||||
self.game_achievements_import_failure(game_id, error)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
imports = [import_game_achievements(game_id) for game_id in game_ids]
|
await self.import_games_achievements(game_ids)
|
||||||
await asyncio.gather(*imports)
|
|
||||||
finally:
|
finally:
|
||||||
self.achievements_import_finished()
|
self.achievements_import_finished()
|
||||||
self._achievements_import_in_progress = False
|
self._achievements_import_in_progress = False
|
||||||
|
|
||||||
asyncio.create_task(import_games_achievements(game_ids))
|
asyncio.create_task(import_games_achievements_task(game_ids))
|
||||||
self._achievements_import_in_progress = True
|
self._achievements_import_in_progress = True
|
||||||
|
|
||||||
|
async def import_games_achievements(self, game_ids):
|
||||||
|
"""Call game_achievements_import_success/game_achievements_import_failure for each game_id on the list"""
|
||||||
|
async def import_game_achievements(game_id):
|
||||||
|
try:
|
||||||
|
achievements = await self.get_unlocked_achievements(game_id)
|
||||||
|
self.game_achievements_import_success(game_id, achievements)
|
||||||
|
except Exception as error:
|
||||||
|
self.game_achievements_import_failure(game_id, error)
|
||||||
|
|
||||||
|
imports = [import_game_achievements(game_id) for game_id in game_ids]
|
||||||
|
await asyncio.gather(*imports)
|
||||||
|
|
||||||
async def get_local_games(self):
|
async def get_local_games(self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@@ -397,28 +401,32 @@ class Plugin():
|
|||||||
if self._game_times_import_in_progress:
|
if self._game_times_import_in_progress:
|
||||||
raise ImportInProgress()
|
raise ImportInProgress()
|
||||||
|
|
||||||
async def import_game_times(game_ids):
|
async def import_game_times_task(game_ids):
|
||||||
try:
|
try:
|
||||||
game_times = await self.get_game_times()
|
await self.import_game_times(game_ids)
|
||||||
game_ids_set = set(game_ids)
|
|
||||||
for game_time in game_times:
|
|
||||||
if game_time.game_id not in game_ids_set:
|
|
||||||
continue
|
|
||||||
self.game_time_import_success(game_time)
|
|
||||||
game_ids_set.discard(game_time.game_id)
|
|
||||||
for game_id in game_ids_set:
|
|
||||||
self.game_time_import_failure(game_id, UnknownError())
|
|
||||||
|
|
||||||
except Exception as error:
|
|
||||||
for game_id in game_ids:
|
|
||||||
self.game_time_import_failure(game_id, error)
|
|
||||||
finally:
|
finally:
|
||||||
self.game_times_import_finished()
|
self.game_times_import_finished()
|
||||||
self._game_times_import_in_progress = False
|
self._game_times_import_in_progress = False
|
||||||
|
|
||||||
asyncio.create_task(import_game_times(game_ids))
|
asyncio.create_task(import_game_times_task(game_ids))
|
||||||
self._game_times_import_in_progress = True
|
self._game_times_import_in_progress = True
|
||||||
|
|
||||||
|
async def import_game_times(self, game_ids):
|
||||||
|
"""Call game_time_import_success/game_time_import_failure for each game_id on the list"""
|
||||||
|
try:
|
||||||
|
game_times = await self.get_game_times()
|
||||||
|
game_ids_set = set(game_ids)
|
||||||
|
for game_time in game_times:
|
||||||
|
if game_time.game_id not in game_ids_set:
|
||||||
|
continue
|
||||||
|
self.game_time_import_success(game_time)
|
||||||
|
game_ids_set.discard(game_time.game_id)
|
||||||
|
for game_id in game_ids_set:
|
||||||
|
self.game_time_import_failure(game_id, UnknownError())
|
||||||
|
except Exception as error:
|
||||||
|
for game_id in game_ids:
|
||||||
|
self.game_time_import_failure(game_id, error)
|
||||||
|
|
||||||
def create_and_run_plugin(plugin_class, argv):
|
def create_and_run_plugin(plugin_class, argv):
|
||||||
if len(argv) < 3:
|
if len(argv) < 3:
|
||||||
logging.critical("Not enough parameters, required: token, port")
|
logging.critical("Not enough parameters, required: token, port")
|
||||||
|
|||||||
Reference in New Issue
Block a user