-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (112 loc) · 3.37 KB
/
testing-and-deployment.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
name: Actions
# repo specific gh actions
env:
SHELLOPTS: 'errexit:pipefail'
PACKAGE_NAME: mapdl-archive
PYVISTA_OFF_SCREEN: true
on:
pull_request:
push:
tags:
- "*"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Build ManyLinux wheel
if: ${{ runner.os == 'Linux' }}
run: |
docker run \
--rm -v `pwd`:/io \
quay.io/pypa/manylinux2014_x86_64 \
/io/.ci/build_wheels.sh ${{ matrix.python-version }}
- name: Build wheel on Windows
if: ${{ runner.os == 'Windows' }}
run: |
pip install build
python -m build
- name: Validate wheel
run: |
pip install twine
twine check dist/*
- name: Install on Linux
if: ${{ runner.os == 'Linux' }}
run: |
pip install wheel
pip install dist/*.whl
pip list
- name: Install on Windows Powershell
if: ${{ runner.os == 'Windows' }}
run: |
pip install wheel
pip install (get-item .\dist\*.whl)
pip list
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Install test requirements
run: pip install -r requirements/requirements_test.txt
- name: Test
run: pytest -v tests/ --durations=0
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-${{ runner.os }}-${{ matrix.python-version }}
path: dist/
retention-days: 7
mac_build:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
name: Build wheels on MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
- name: List generated wheels
run: |
ls ./wheelhouse/*
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
release:
name: Release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build, mac_build]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mapdl-archive
permissions:
id-token: write # this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: Move wheels to dist
run: |
mkdir -p dist/
find . -name "*.whl" -exec mv {} dist/ \;
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
./**/*.whl