-
Notifications
You must be signed in to change notification settings - Fork 2
196 lines (175 loc) · 5.5 KB
/
ci_cd.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: GitHub CI
on:
pull_request:
push:
tags:
- '*'
branches:
- develop
- release-*
workflow_dispatch:
env:
DOCUMENTATION_CNAME: 'edb.docs.pyansys.com'
MAIN_PYTHON_VERSION: '3.10'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: PyAnsys code style checks
uses: ansys/actions/code-style@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
uses: ansys/actions/doc-style@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
tests:
name: Tests and coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade .[test]
python -m pip install --upgrade tox-gh-actions
- name: Test with tox
# Only the tox environment specified in the tox.ini gh-actions is run
run: tox -e test -- --ignore=tests/e2e
# TODO: convert to ansys/actions/doc-build
doc-build:
name: Build documentation
runs-on: ubuntu-latest
needs: [doc-style]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade .[test]
- name: Generate the documentation with tox
run: tox -e doc
- name: Upload HTML Documentation
uses: actions/upload-artifact@v2
with:
name: HTML-Documentation
path: .tox/doc_out
retention-days: 7
build:
name: Build library
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip flit twine
- name: Build Core
run: |
flit build
- name: Validate libraries
run: |
python -m twine check dist/*
- name: Zip libraries
run: |
cd dist
zip -r pyedb.zip *
- name: Upload develop libraries
if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release-') || contains(github.ref, 'refs/tags'))
uses: actions/upload-artifact@v2
with:
name: pyedb
path: dist/pyedb.zip
retention-days: 14
release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build, tests, doc-build]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.7
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: Generate release notes
uses: docker://pandoc/core:2.9
with:
args: --output=release_notes.md doc/source/api/release_notes.rst
- name: Publish release
uses: softprops/action-gh-release@v1
with:
body_path: release_notes.md
files: ./**/pyedb.zip
token: ${{ secrets.PYANSYS_PYEDB_BOT_TOKEN }}
prerelease: true
- name: Notify Success
uses: skitionek/notify-microsoft-teams@master
if: success()
with:
webhook_url: ${{ secrets.MS_TEAMS_PUBLIC }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
overwrite: "{
title: `New release has been published at https://github.com/ansys/pyedb/releases`,
}"
- name: Notify Failure
uses: skitionek/notify-microsoft-teams@master
if: failure()
with:
webhook_url: ${{ secrets.MS_TEAMS_DEV }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
overwrite: "{
title: `Release FAILED!`,
}"
doc-deploy-dev:
name: "Deploy development documentation"
# Deploy development only when merging or pushing to the 'main' branch
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [doc-build, build]
steps:
- uses: ansys/actions/doc-deploy-dev@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-Documentation
doc-deploy-stable:
name: "Deploy stable documentation"
# Deploy release documentation when creating a new tag
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: release
steps:
- uses: ansys/actions/doc-deploy-stable@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-Documentation