-
Notifications
You must be signed in to change notification settings - Fork 7
179 lines (153 loc) · 4.92 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
171
172
173
174
175
176
177
178
179
name: CI
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
env:
MAIN_PYTHON_VERSION: "3.10"
DOCUMENTATION_CNAME: 'twin.docs.pyansys.com'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
doc-style:
name: "Running documentation style checks"
runs-on: ubuntu-latest
steps:
- name: "Running documentation style checks"
uses: ansys/actions/doc-style@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
doc-build:
name: "Building library documentation"
runs-on: pytwin-win10
needs: doc-style
steps:
- name: "Install Git and clone project"
uses: actions/checkout@v4
- name: "Set up Python"
uses: ansys/actions/_setup-python@v8
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-cache: true
- name: "Update pip"
shell: bash
run: python -m pip install -U pip
- name: "Install Python library"
shell: bash
run: |
python -m pip install poetry
poetry install
- name: "Install documentation dependencies"
shell: bash
run: poetry install --with doc
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: "Install DPF server"
shell: bash
run: |
cp -r ~ansys/Documents/devEnv/pyansys/pytwin/ansys_dpf_server_win_v2024.1.pre0/ ./
cd ansys_dpf_server_win_v2024.1.pre0
pip install -e .
cd ..
- name: "Clean documentation build folder"
shell: bash
run: doc/make.bat clean
- name: "Build HTML documentation"
shell: bash
run: doc/make.bat html
env:
ANSYS_DPF_ACCEPT_LA: Y
- name: "Upload HTML documentation artifact"
uses: actions/upload-artifact@v4
with:
name: documentation-html
path: doc/_build/html
retention-days: 7
build-library:
name: "Smoke test and building"
runs-on: ubuntu-latest
steps:
- name: "Build library source and wheel artifacts"
uses: ansys/actions/build-library@v8
with:
library-name: "pytwin"
python-version: ${{ env.MAIN_PYTHON_VERSION }}
tests:
name: Test library
needs: build-library
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-20.04]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Install Ubuntu dependencies for RomViewerSharedLib.so
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install libosmesa6
- name: Setup headless display
if: matrix.os == 'windows-latest'
uses: pyvista/setup-headless-display-action@v2
- name: Run pytest
uses: ansys/actions/tests-pytest@v8
with:
python-version: ${{ matrix.python-version }}
pytest-extra-args: "--cov=pytwin --cov-report=term --cov-report=xml:.cov/coverage.xml --cov-report=html:.cov/html"
env:
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}
- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.python-version }}_${{ matrix.os }}_pytest.html
path: .cov/html
retention-days: 7
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v4
check-licenses:
name: "Check library dependencies ship with valid licenses"
runs-on: ubuntu-latest
steps:
- name: "Validate third party licenses"
uses: ansys/actions/check-licenses@v8
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
release-pypi-public:
name: "Release to public PyPI"
runs-on: ubuntu-latest
needs: [tests, doc-build]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to the public PyPI repository"
uses: ansys/actions/release-pypi-public@v8
with:
library-name: "pytwin"
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}
doc-deploy-dev:
name: "Deploy developers documentation"
runs-on: ubuntu-latest
needs: doc-build
if: github.ref == 'refs/heads/main'
steps:
- name: "Deploy the latest documentation"
uses: ansys/actions/doc-deploy-dev@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-deploy-stable:
name: "Deploy stable documentation"
runs-on: ubuntu-latest
needs: doc-build
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Deploy the stable documentation"
uses: ansys/actions/doc-deploy-stable@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}