generated from ansys/template
-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (190 loc) · 5.67 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
# check spelling, codestyle
name: Build and Test Package
# run only on main branch. This avoids duplicated actions on PRs
on:
pull_request:
merge_group:
push:
tags:
- "*"
branches:
- main
jobs:
code-style:
name: "Code style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/[email protected]
with:
skip-install: false
docs-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
uses: pyansys/actions/doc-style@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
test:
name: Unit test on supported platforms
runs-on: ubuntu-latest
services:
# Label used to access the service container
kdc-server:
# Github container registry address
image: ghcr.io/ansys/kdc-container:v0.2
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
volumes:
# This is needed otherwise there won't be enough entropy to generate a new kerberos realm
- /dev/urandom:/dev/random
- /tmp/keytabs:/tmp/keytabs
ports:
- 749:749
- 88:88/udp
container:
image: python:${{ matrix.python-version }}
volumes:
- /tmp/keytabs:/tmp/keytabs
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Configure host kerberos
run: |
apt update
export DEBIAN_FRONTEND=noninteractive
apt install -yq krb5-user
cp ./tests/integration/krb5.conf /etc/krb5.conf
./tests/integration/configure_keytab.sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install 'tox<4' poetry
- name: Test with tox
run: tox -- --with-kerberos
- name: Upload coverage report
uses: codecov/codecov-action@v3
if: ${{ github.actor != 'dependabot[bot]' }}
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install kerberos headers
run: |
sudo apt-get update
sudo apt install libkrb5-dev
- name: Create wheel
run: |
pip install poetry
poetry build
- name: Validate wheel
run: |
pip install twine
twine check dist/*
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: ansys-grantami-common-wheel
path: dist/
retention-days: 7
docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install kerberos headers
run: |
sudo apt-get update
sudo apt install libkrb5-dev
- name: Install library
run: |
pip install poetry
poetry config installer.modern-installation false
poetry install --with docs --extras "oidc linux-kerberos"
- name: Build HTML
run: make -C doc html SPHINXOPTS="-W"
- name: Build PDF Documentation
run: |
sudo apt update
sudo apt-get install -y texlive-latex-extra latexmk texlive-xetex fonts-freefont-otf xindy
make -C doc latexpdf
- name: Upload HTML Documentation
uses: actions/upload-artifact@v4
with:
name: Documentation-html
path: doc/build/html
retention-days: 7
- name: Upload PDF Documentation
uses: actions/upload-artifact@v4
with:
name: Documentation-pdf
path: doc/build/latex/*.pdf
retention-days: 7
Release:
if: contains(github.ref, 'refs/tags')
needs: [build, test, style, docs]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/checkout@v4
# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v1
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}
- uses: actions/download-artifact@v4
with:
name: ansys-grantami-common-wheel
path: ~/dist
- uses: actions/download-artifact@v4
with:
name: Documentation-pdf
path: ~/pdf
- uses: actions/download-artifact@v4
with:
name: Documentation-html
path: ~/html
- name: Deploy
uses: JamesIves/[email protected]
with:
repository-name: pyansys/openapi-common-docs
token: ${{ steps.get_workflow_token.outputs.token }}
BRANCH: gh-pages
FOLDER: ~/html
CLEAN: true
# note how we use the PyPI tokens
- name: Upload to PyPi
run: |
pip install twine
twine upload --non-interactive --skip-existing ~/**/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
./**/*.whl
./**/*.zip
./**/*.pdf