Skip to content
Snippets Groups Projects
Commit 17847515 authored by Mikkel Friis-Møller's avatar Mikkel Friis-Møller
Browse files

added ci

parent 3eee53e4
No related branches found
No related tags found
No related merge requests found
Pipeline #26483 failed
image: continuumio/anaconda3
# ===== Check code style =====
check_code_style:
stage:
test
script:
- pip install -e .
- pycodestyle --ignore=E501,W504,E741 py_wake
tags:
- python
# ===== TEST EDWIN debian=====
test_EDWIN:
stage:
test
script:
- pip install -e .[test] --timeout 60
- pytest
tags:
- ci-ubuntu
# ===== TEST EDWIN on Windows =====
test_EDWIN_windows:
stage:
test
script:
- conda init powershell
- "if (test-path $PROFILE.CurrentUserAllHosts) { & $PROFILE.CurrentUserAllHosts}"
- conda activate py36_openmdao26
- pip install -e .[test]
- pytest --cov-report term-missing:skip-covered --cov=py_wake --cov-config .coveragerc
tags:
- ANMH_old
pypi:
stage:
deploy
only:
- tags
script:
- python3 -m pip install -U setuptools wheel
- python3 setup.py sdist bdist_wheel
- python3 -m pip install -U twine
- twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD
tags:
- python
LICENSE 0 → 100644
MIT License
Copyright (c) 2018 TOPFARM
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
import numpy
npt = numpy.testing
\ No newline at end of file
from edwin.tests import npt
from edwin.wind_farm_network import WindFarmNetwork
method='test'
wfn = WindFarmNetwork(method)
def test_wind_farm_network():
assert wfn.method == 'test'
\ No newline at end of file
class WindFarmNetwork():
def __init__(self, method):
self.method = method
\ No newline at end of file
'''
Created on 28. jul. 2017
@author: mmpe
'''
import os
import subprocess
def _run_git_cmd(cmd, git_repo_path=None):
git_repo_path = git_repo_path or os.getcwd()
if not os.path.isdir(os.path.join(git_repo_path, ".git")):
raise Warning("'%s' does not appear to be a Git repository." % git_repo_path)
try:
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
cwd=os.path.abspath(git_repo_path))
stdout,stderr = process.communicate()
if process.returncode != 0:
raise EnvironmentError("%s\n%s"%(stdout, stderr))
return stdout.strip()
except EnvironmentError as e:
raise e
raise Warning("unable to run git")
def get_git_version(git_repo_path=None):
cmd = ["git", "describe", "--tags", "--dirty", "--always"]
return _run_git_cmd(cmd, git_repo_path)
def get_tag(git_repo_path=None, verbose=False):
tag = _run_git_cmd(['git', 'describe', '--tags', '--always', '--abbrev=0'], git_repo_path)
if verbose:
print(tag)
return tag
def set_tag(tag, push, git_repo_path=None):
_run_git_cmd(["git", "tag", tag], git_repo_path)
if push:
_run_git_cmd(["git", "push"], git_repo_path)
_run_git_cmd(["git", "push", "--tags"], git_repo_path)
def update_git_version(version_module, git_repo_path=None):
"""Update <version_module>.__version__ to git version"""
version_str = get_git_version(git_repo_path)
assert os.path.isfile(version_module.__file__)
with open(version_module.__file__, "w") as fid:
fid.write("__version__ = '%s'" % version_str)
# ensure file is written, closed and ready
with open(version_module.__file__) as fid:
fid.read()
return version_str
def write_vers(vers_file='wetb/__init__.py', repo=None, skip_chars=1):
if not repo:
repo = os.getcwd()
version = get_tag(repo)[skip_chars:]
print('Writing version: {} in {}'.format(version, vers_file))
with open(vers_file, 'r') as f:
lines = f.readlines()
for n, l in enumerate(lines):
if l.startswith('__version__'):
lines[n] = "__version__ = '{}'\n".format(version)
for n, l in enumerate(lines):
if l.startswith('__release__'):
lines[n] = "__release__ = '{}'\n".format(version)
with open(vers_file, 'w') as f:
f.write(''.join(lines))
return version
def rename_dist_file():
for f in os.listdir('dist'):
if f.endswith('whl'):
split = f.split('linux')
new_name = 'manylinux1'.join(split)
old_path = os.path.join('dist', f)
new_path = os.path.join('dist', new_name)
os.rename(old_path, new_path)
def main():
"""Example of how to run (pytest-friendly)"""
if __name__ == '__main__':
pass
main()
setup.py 0 → 100644
# -*- coding: utf-8 -*-
"""
Setup file for EDWIN
"""
import os
from setuptools import setup, find_packages
import pkg_resources
repo = os.path.dirname(__file__)
try:
from git_utils import write_vers
version = write_vers(vers_file='py_wake/__init__.py', repo=repo, skip_chars=1)
except Exception:
version = '999'
try:
from pypandoc import convert_file
def read_md(f): return convert_file(f, 'rst', format='md')
except ImportError:
print("warning: pypandoc module not found, could not convert Markdown to RST")
def read_md(f): return open(f, 'r').read()
setup(name='edwin',
version=version,
description='EDWIN an optimization and design package for electrical networks in windfarms',
long_description=read_md('README.md'),
url='https://gitlab.windenergy.dtu.dk/TOPFARM/edwin',
author='DTU Wind Energy',
author_email='juru@dtu.dk',
license='MIT',
packages=find_packages(),
},
install_requires=[
'matplotlib', # for plotting
'numpy', # for numerical calculations
'xarray', # for WaspGridSite data storage
'scipy', # constraints
],
zip_safe=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment