-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (197 loc) · 6.81 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: CI
on:
pull_request:
workflow_dispatch:
push:
tags:
- "v*.*.*"
branches:
- main
env:
MAIN_SCADE_VERSION: '23.2'
MAIN_PYTHON_VERSION: '3.10'
DOCUMENTATION_CNAME: 'actions.scade.docs.pyansys.com'
test-library-name: 'ansys-scade-actions'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
labeler:
name: "Label syncer"
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Label based on changed files
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'doc') ||
startsWith(github.event.pull_request.head.ref, 'docs')
with:
labels: documentation
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'maint') ||
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
startsWith(github.event.pull_request.head.ref, 'ci')
with:
labels: maintenance
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'feat')
with:
labels: |
enhancement
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'fix') ||
startsWith(github.event.pull_request.head.ref, 'patch')
with:
labels: bug
- name: Suggest to add labels
uses: peter-evans/create-or-update-comment@v4
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Please add one of the following labels to add this contribution to the Release Notes :point_down:
- [bug](https://github.com/ansys/scade-actions/pulls?q=label%3Abug+)
- [documentation](https://github.com/ansys/scade-actions/pulls?q=label%3Adocumentation+)
- [enhancement](https://github.com/ansys/scade-actions/pulls?q=label%3Aenhancement+)
- [good first issue](https://github.com/ansys/scade-actions/pulls?q=label%3Agood+first+issue)
- [maintenance](https://github.com/ansys/scade-actions/pulls?q=label%3Amaintenance+)
- [release](https://github.com/ansys/scade-actions/pulls?q=label%3Arelease+)
commit-and-branch-style:
name: "Commit and branch style"
runs-on: ubuntu-latest
needs: labeler
steps:
- name: "Check commit style"
uses: ansys/actions/commit-style@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Check branch naming convention"
uses: ansys/actions/branch-name-style@v6
code-style:
name: "Code style"
runs-on: ubuntu-latest
needs: commit-and-branch-style
steps:
- name: "Run code style checks"
uses: ansys/actions/code-style@v6
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false
- name: "Verify private actions are not pointing to the 'main' branch"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
run: |
if $(grep -q --exclude-dir={.git,.github,doc} "ansys\/actions\/.*\@main" -r .); then
echo -e "\033[1;91m[ERROR]: Found private actions pointing to the 'main' branch.\033[0m"
grep -q --exclude-dir={.git,.github,doc} "ansys\/actions\/.*\@main" -r .
fi
doc-style:
name: "Doc style"
runs-on: ubuntu-latest
needs: commit-and-branch-style
steps:
- name: "Run documentation style checks"
uses: ansys/actions/doc-style@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
doc-build:
name: "Doc build"
runs-on: ubuntu-latest
needs: doc-style
steps:
- name: "Build documentation"
uses: ansys/actions/doc-build@v6
with:
skip-install: true
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false
dependencies: "texlive-fonts-extra qpdf"
tests:
name: "Tests"
runs-on: [self-hosted, 'SCADE']
strategy:
matrix:
scade-version: ['23.2']
fail-fast: false
steps:
- name: "Execute setup.py tests"
uses: ./scade-tests-pytest
with:
scade-version: ${{ matrix.scade-version }}
library-dir: "tests/python-setup"
pytest-postargs: "tests/python-setup/tests -vv"
checkout: false
- name: "Execute pyproject tests"
uses: ./scade-tests-pytest
with:
scade-version: ${{ matrix.scade-version }}
library-dir: "tests/python-pyproject"
pytest-postargs: "tests/python-pyproject/tests -vv"
checkout: false
doc-deploy-dev:
name: "Deploy developers documentation"
needs: [doc-build, tests]
runs-on: ubuntu-latest
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags')
steps:
- uses: ansys/actions/doc-deploy-dev@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
release:
name: "Release to GitHub"
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [doc-build, tests]
steps:
- name: "Download HTML documentation"
uses: actions/download-artifact@v4
with:
name: documentation-html
path: documentation-html
- name: "Zip HTML documentation"
uses: vimtor/[email protected]
with:
files: documentation-html
dest: documentation-html.zip
- name: "Download PDF documentation"
uses: actions/download-artifact@v4
with:
name: documentation-pdf
path: documentation-pdf
- name: "Zip PDF documentation"
uses: vimtor/[email protected]
with:
files: documentation-pdf
dest: documentation-pdf.zip
- name: "Display the structure of downloaded files"
shell: bash
run: ls -R
- name: "Release to GitHub"
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
documentation-html.zip
documentation-pdf.zip
doc-deploy-stable:
name: "Upload stable documentation"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: release
steps:
- uses: ansys/actions/doc-deploy-stable@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}