Skip to content

Commit

Permalink
Merge pull request #384 from JrGoodle/appveyor
Browse files Browse the repository at this point in the history
Add support for AppVeyor to test on Windows
  • Loading branch information
JrGoodle committed Nov 12, 2017
2 parents 3016ca2 + 4dc990f commit 5c51b7a
Show file tree
Hide file tree
Showing 14 changed files with 568 additions and 453 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# `clowder`
[![Build Status](https://travis-ci.org/JrGoodle/clowder.svg)](https://travis-ci.org/JrGoodle/clowder)
[![Build status](https://ci.appveyor.com/api/projects/status/pmf4h6etnb3bbd9y?svg=true)](https://ci.appveyor.com/project/JrGoodle/clowder)
[![Maintainability](https://api.codeclimate.com/v1/badges/56c92799de08f9ef9258/maintainability)](https://codeclimate.com/github/JrGoodle/clowder/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/56c92799de08f9ef9258/test_coverage)](https://codeclimate.com/github/JrGoodle/clowder/test_coverage)
[![PyPI version](https://badge.fury.io/py/clowder-repo.svg)](https://badge.fury.io/py/clowder-repo)
Expand Down
70 changes: 70 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
environment:

matrix:

# For Python versions available on Appveyor, see
# http://www.appveyor.com/docs/installed-software#python
# The list here is complete (excluding Python 2.6, which
# isn't covered by this document) at the time of writing.

# - PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python33"
- PYTHON: "C:\\Python34"
- PYTHON: "C:\\Python35"
# - PYTHON: "C:\\Python27-x64"
# - PYTHON: "C:\\Python33-x64"
# DISTUTILS_USE_SDK: "1"
- PYTHON: "C:\\Python34-x64"
DISTUTILS_USE_SDK: "1"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36-x64"

install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- pip install -e clowder
# # We need wheel installed to build wheels
# - "%PYTHON%\\python.exe -m pip install wheel"

build: off

test_script:
# Put your test command here.
# If you don't need to build C extensions on 64-bit Python 3.3 or 3.4,
# you can remove "build.cmd" from the front of the command, as it's
# only needed to support those cases.
# Note that you must use the environment variable %PYTHON% to refer to
# the interpreter you're using - Appveyor does not do anything special
# to put the Python version you want to use on PATH.
# - "build.cmd %PYTHON%\\python.exe clowder\\setup.py"
- cd examples\cats
- clowder init https://github.com/jrgoodle/cats.git
- clowder herd
- clowder herd --parallel
- clowder status
- clowder branch
# - clowder forall -c 'copy NUL empty-file.txt'
- clowder diff
- clowder clean -g black-cats
- clowder stash -g cats
- clowder start new_branch
- clowder checkout master -g black-cats
- clowder reset
- clowder prune new_branch
- clowder save vWin
- clowder yaml

# after_test:
# # This step builds your wheels.
# # Again, you only need build.cmd if you're building C extensions for
# # 64-bit Python 3.3/3.4. And you need to use %PYTHON% to get the correct
# # interpreter
# - "build.cmd %PYTHON%\\python.exe setup.py bdist_wheel"

# artifacts:
# # bdist_wheel puts your built wheel in the dist directory
# - path: dist\*

#on_success:
# You can use this step to upload your artifacts to a public website.
# See Appveyor's documentation for more details. Or you can simply
# access your wheels from the Appveyor "artifacts" tab for your build.
5 changes: 2 additions & 3 deletions clowder/clowder/cli/diff_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class Meta:
@expose(
help='Show git diff for projects',
arguments=[
(['branch'], dict(nargs=1, action='store', help='branch to checkout', metavar='BRANCH')),
(['--groups', '-g'], dict(choices=CLOWDER_CONTROLLER.get_all_group_names(),
default=CLOWDER_CONTROLLER.get_all_group_names(),
nargs='+', metavar='GROUP',
Expand Down Expand Up @@ -62,9 +61,9 @@ def _diff(self):
if self.app.pargs.projects is None:
groups = filter_groups(CLOWDER_CONTROLLER.groups, self.app.pargs.groups)
for group in groups:
run_group_command(group, [], 'diff')
run_group_command(group, self.app.pargs.skip, 'diff')
return

projects = filter_projects(CLOWDER_CONTROLLER.groups, project_names=self.app.pargs.projects)
for project in projects:
run_project_command(project, [], 'diff')
run_project_command(project, self.app.pargs.skip, 'diff')
43 changes: 41 additions & 2 deletions clowder/clowder/cli/forall_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
"""

from __future__ import print_function

import os

from cement.ext.ext_argparse import ArgparseController, expose

from clowder.cli.parallel_commands import forall
from clowder.clowder_controller import CLOWDER_CONTROLLER
from clowder.clowder_repo import print_clowder_repo_status
from clowder.util.clowder_utils import (
filter_projects,
options_help_message,
run_project_command
)
from clowder.util.decorators import valid_clowder_yaml_required
from clowder.util.clowder_utils import options_help_message
from clowder.util.parallel_commands import forall_parallel


class ForallController(ArgparseController):
Expand Down Expand Up @@ -60,3 +68,34 @@ def _forall(self):
forall(CLOWDER_CONTROLLER, self.app.pargs.command, self.app.pargs.ignore_errors,
group_names=self.app.pargs.groups, project_names=self.app.pargs.projects,
skip=self.app.pargs.skip, parallel=self.app.pargs.parallel)


def forall(clowder, command, ignore_errors, group_names, **kwargs):
"""Runs script in project directories specified
.. py:function:: forall_script(clowder, command, ignore_errors, group_names, project_names=None, skip=[], parallel=False)
:param ClowderController clowder: ClowderController instance
:param list[str] command: Command or script and optional arguments
:param bool ignore_errors: Whether to exit if command returns a non-zero exit code
:param list[str] group_names: Group names to run command for
Keyword Args:
project_names (list[str]): Project names to clean
skip list[str]: Project names to skip
parallel bool: Whether command is being run in parallel, affects output
"""

project_names = kwargs.get('project_names', None)
skip = kwargs.get('skip', [])
parallel = kwargs.get('parallel', False)

projects = filter_projects(clowder.groups, group_names=group_names, project_names=project_names)

if parallel:
forall_parallel([" ".join(command)], skip, ignore_errors, projects)
if os.name == "posix":
return

for project in projects:
run_project_command(project, skip, 'run', [" ".join(command)], ignore_errors)
63 changes: 57 additions & 6 deletions clowder/clowder/cli/herd_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@
"""

from __future__ import print_function

import os

from cement.ext.ext_argparse import ArgparseController, expose

from clowder.cli.parallel_commands import (
herd,
herd_parallel
)
from clowder.clowder_controller import CLOWDER_CONTROLLER
from clowder.clowder_repo import print_clowder_repo_status_fetch
from clowder.util.clowder_utils import (
filter_groups,
filter_projects,
options_help_message,
run_group_command,
run_project_command,
validate_groups,
validate_projects
)
from clowder.util.connectivity import network_connection_required
from clowder.util.decorators import valid_clowder_yaml_required
from clowder.util.clowder_utils import options_help_message
from clowder.util.parallel_commands import herd_parallel


class HerdController(ArgparseController):
Expand Down Expand Up @@ -76,6 +85,48 @@ def _herd(self):

if self.app.pargs.parallel:
herd_parallel(CLOWDER_CONTROLLER, **kwargs)
return
if os.name == "posix":
return

herd(CLOWDER_CONTROLLER, **kwargs)


def herd(clowder, group_names, **kwargs):
"""Clone projects or update latest from upstream
.. py:function:: herd(clowder, group_names, branch=None, tag=None, depth=0, rebase=False, project_names=None, skip=[], protocol=None)
:param ClowderController clowder: ClowderController instance
:param list[str] group_names: Group names to herd
Keyword Args:
branch (str): Branch to attempt to herd
tag (str): Tag to attempt to herd
depth (int): Git clone depth. 0 indicates full clone, otherwise must be a positive integer
protocol (str): Git protocol ('ssh' or 'https')
rebase (bool): Whether to use rebase instead of pulling latest changes
project_names (list[str]) project_names: Project names to herd
skip (list[str]): Project names to skip
"""

project_names = kwargs.get('project_names', None)
skip = kwargs.get('skip', [])
branch = kwargs.get('branch', None)
tag = kwargs.get('tag', None)
depth = kwargs.get('depth', None)
rebase = kwargs.get('rebase', False)
protocol = kwargs.get('protocol', None)

if project_names is None:
groups = filter_groups(clowder.groups, group_names)
validate_groups(groups)
for group in groups:
run_group_command(group, skip, 'herd', branch=branch, tag=tag,
depth=depth, rebase=rebase, protocol=protocol)
return

projects = filter_projects(clowder.groups, project_names=project_names)
validate_projects(projects)
for project in projects:
run_project_command(project, skip, 'herd', branch=branch, tag=tag,
depth=depth, rebase=rebase, protocol=protocol)

0 comments on commit 5c51b7a

Please sign in to comment.