-
Notifications
You must be signed in to change notification settings - Fork 1
170 lines (149 loc) · 4.98 KB
/
ci.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# DOCS:
# 1. https://help.github.com/en/articles/workflow-syntax-for-github-actions
name: wiji ci
on:
pull_request:
push:
branches:
- master
jobs:
check_release_notes:
name: check_release_notes
timeout-minutes: 1
strategy:
matrix:
platform: [ubuntu-22.04]
runs-on: ${{ matrix.platform }}
steps:
# checkout master branch and the current branch so that we are able to do diff operations.
- name: checkout master branch too.
uses: actions/checkout@v4
with:
ref: master
- name: Check out code
uses: actions/checkout@v4
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
- name: check if changes have release notes
if: ${{ github.ref != 'refs/heads/master' }}
env:
GIT_BRANCH: ${{ github.ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_BASE_REF: ${{ github.base_ref }}
run: |
printf "GIT_BRANCH: $GIT_BRANCH \n"
printf "GITHUB_HEAD_REF: $GITHUB_HEAD_REF \n"
printf "GITHUB_BASE_REF: $GITHUB_BASE_REF \n"
printf "list git branches: \n"
git branch --list --all
if [[ "$GIT_BRANCH" == "refs/heads/master" ]]
then
printf "\n $GIT_BRANCH branch, ignoring check for relese notes \n"
elif [[ "$GIT_BRANCH" == *"refs/tags/"* ]]
then
printf "\n $GIT_BRANCH branch, ignoring check for relese notes \n"
else
ChangedFiles=`git diff --name-only remotes/origin/master`
echo $ChangedFiles
case "$ChangedFiles" in
*CHANGELOG.*)
printf "\n Thanks, your commits include update to release notes. \n";;
*)
printf "\n You should add release notes to CHANGELOG.md \n" && exit 77;;
esac
fi
run_tests:
name: run_tests
timeout-minutes: 7
strategy:
matrix:
python-version: ["3.11", "3.12"]
platform: [ubuntu-22.04]
runs-on: ${{ matrix.platform }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: run_tests
run: |
ulimit -a
env
set -x
pwd
pip install -e .[dev,test]
find . -name '*.pyc' -delete;find . -name '__pycache__' -delete | xargs echo
# normal coverage
coverage erase
coverage run --omit="*tests*,*cli/test_*,*examples/*,*.virtualenvs/*,*virtualenv/*,*.venv/*,*__init__*" -m unittest discover -v -s .
codecov
coverage report --show-missing --fail-under=70
# branch coverage
coverage erase
coverage run --branch --omit="*tests*,*cli/test_*,*examples/*,*.virtualenvs/*,*virtualenv/*,*.venv/*,*__init__*" -m unittest discover -v -s .
codecov
coverage report --show-missing --fail-under=67
env:
WIJI_DEBUG: '1'
PYTHONASYNCIODEBUG: '1'
run_analysis:
name: run_analysis
timeout-minutes: 8
strategy:
matrix:
python-version: ["3.11"]
platform: [ubuntu-22.04]
runs-on: ${{ matrix.platform }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: run_analysis
run: |
ulimit -a
env
set -x
pwd
pip install -e .[dev,test]
find . -name '*.pyc' -delete;find . -name '__pycache__' -delete | xargs echo
python --version
black --line-length=100 --check . || { printf "\\n\\t please use black to format your code."; exit 77; }
flake8 .
pylint --enable=E --disable=W,R,C --unsafe-load-any-extension=y wiji/ cli/ tests/ documentation/
bandit -r --exclude .venv -ll .
mypy --show-column-numbers -p cli -p wiji #--strict
env:
WIJI_DEBUG: '1'
PYTHONASYNCIODEBUG: '1'
run_wiji:
name: run_wiji
timeout-minutes: 8
strategy:
matrix:
python-version: ["3.11"]
platform: [ubuntu-22.04]
runs-on: ${{ matrix.platform }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: run_wiji
run: |
ulimit -a
env
set -x
pwd
pip install -e .[dev,test]
find . -name '*.pyc' -delete;find . -name '__pycache__' -delete | xargs echo
wiji-cli --version
wiji-cli --app tests.testdata.cli.my_app.MyAppInstance --dry-run
env:
WIJI_DEBUG: '1'
PYTHONASYNCIODEBUG: '1'