forked from a2i2/surround
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codefresh.yml
132 lines (109 loc) · 4.05 KB
/
codefresh.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# More examples of Codefresh YAML can be found at
# https://codefresh.io/docs/docs/yaml-examples/examples/
version: "1.0"
# Stages can help you organize your steps in stages
stages:
- "clone"
- "test"
- "release"
steps:
clone:
title: "Cloning repository"
type: "git-clone"
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
# CF_BRANCH value is auto set when pipeline is triggered
# Learn more at codefresh.io/docs/docs/codefresh-yaml/variables/
revision: "${{CF_BRANCH}}"
git: "github"
stage: "clone"
test:
stage: "test"
type: parallel
steps:
test_lib:
title: "Test Surround Library"
type: "freestyle" # Run any command
image: "python:3.6.10" # The image in which command will be executed
working_directory: "${{clone}}"
commands:
# Go inside the surround library
- cd surround
# Remove generated tox directory
- rm -rf .tox
# Install tox
- pip install tox==3.20.1
# Run tests through tox
- tox
test_cli:
title: "Test Surround CLI"
type: "freestyle" # Run any command
image: "python:3.6.10" # The image in which command will be executed
working_directory: "${{clone}}"
commands:
# Go inside the cli
- cd surround_cli
# Remove generated tox directory
- rm -rf .tox
# Install tox
- pip install tox==3.20.1
# Run tests through tox
- tox
# Run examples
- python setup.py install
- cd ..
- find examples/ -iname "*.py" | xargs pylint
- ls examples/ | xargs -n 1 -I '{}' python3 examples/'{}'/main.py
release:
stage: "release"
type: parallel
steps:
release_lib:
title: "Release surround lib to PYPI"
type: "freestyle"
image: "python:3.6.10" # The image in which command will be executed
working_directory: "${{clone}}" # Running command where code cloned
commands:
- cd surround
# Remove generated files from last release
- rm -rf dist
# Install required packages
- python3 -m pip install --user --upgrade setuptools wheel twine
# Setup Pypi config
- echo "[pypi]" > ~/.pypirc
- echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc
- echo "username=${{PYPI_USERNAME}}" >> ~/.pypirc
- echo "password=${{PYPI_PASSWORD}}" >> ~/.pypirc
# Build package
- python3 setup.py sdist bdist_wheel
# Upload package for distribution
- python3 -m twine upload --repository pypi dist/*
when:
condition:
all:
isMainRepo: '"${{CF_REPO_OWNER}}" == "a2i2"'
isReleaseBranch: 'match("${{CF_BRANCH}}", "surround-v([0-9]+)\.([0-9]+)\.([0-9]+)?$", false) == true'
release_cli:
title: "Release surround cli to PYPI"
type: "freestyle"
image: "python:3.6.10" # The image in which command will be executed
working_directory: "${{clone}}" # Running command where code cloned
commands:
- cd surround_cli
# Remove generated files from last release
- rm -rf dist
# Install required packages
- python3 -m pip install --user --upgrade setuptools wheel twine
# Setup Pypi config
- echo "[pypi]" > ~/.pypirc
- echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc
- echo "username=${{PYPI_USERNAME}}" >> ~/.pypirc
- echo "password=${{PYPI_PASSWORD}}" >> ~/.pypirc
# Build package
- python3 setup.py sdist bdist_wheel
# Upload package for distribution
- python3 -m twine upload --repository pypi dist/*
when:
condition:
all:
isMainRepo: '"${{CF_REPO_OWNER}}" == "a2i2"'
isReleaseBranch: 'match("${{CF_BRANCH}}", "surround-cli-v([0-9]+)\.([0-9]+)\.([0-9]+)?$", false) == true'