generated from ansys/template
-
Notifications
You must be signed in to change notification settings - Fork 0
222 lines (191 loc) · 6.05 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
# 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
env:
MAIN_PYTHON_VERSION: '3.10'
LIBRARY_NAME: 'ansys-openapi-common'
jobs:
code-style:
name: "Code style"
runs-on: windows-latest
steps:
- uses: ansys/actions/code-style@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
skip-install: "false"
doc-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 }}
doc-build:
name: Build Documentation
runs-on: ubuntu-latest
needs: doc-style
steps:
- name: "Checkout the repository"
uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Install system dependencies"
run: |
sudo apt-get update && sudo apt-get install pandoc libkrb5-dev
- name: "Install Python dependencies"
run: |
python -m pip install --upgrade pip tox
python -m pip install poetry~=1.7.0
- name: Install library
run: |
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
smoke-tests:
name: "Build wheelhouse for latest Python versions"
runs-on: ${{ matrix.os }}
needs: code-style
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Install kerberos headers
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt install libkrb5-dev
- uses: ansys/actions/build-wheelhouse@v5
with:
library-name: ${{ env.LIBRARY_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
tests:
name: Unit test on supported platforms
runs-on: ubuntu-latest
needs: smoke-tests
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-library:
name: "Build library"
runs-on: ubuntu-latest
needs: [ doc-build, tests ]
steps:
- name: Install kerberos headers
run: |
sudo apt-get update
sudo apt install libkrb5-dev
- uses: ansys/actions/build-library@v5
with:
library-name: ${{ env.LIBRARY_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
release:
name: "Release"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build-library]
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/release-pypi-public@v5
name: "Release to public PyPI"
with:
library-name: ${{ env.LIBRARY_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}
- uses: ansys/actions/release-github@v5
name: "Release to GitHub"
with:
library-name: ${{ env.LIBRARY_NAME }}
doc-deploy-stable:
name: "Deploy stable documentation"
runs-on: ubuntu-latest
needs: release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v3
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}
- 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