forked from ZealanL/RocketSim
-
Notifications
You must be signed in to change notification settings - Fork 4
165 lines (140 loc) · 4.34 KB
/
main.yml
File metadata and controls
165 lines (140 loc) · 4.34 KB
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
name: Build
on:
push:
tags:
- v*
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_wheel:
name: build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, ubuntu-22.04, ubuntu-22.04-arm, macos-14]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
pip3 install wheel numpy cibuildwheel
- name: Build extension for ${{ matrix.os }}
shell: bash
if: runner.os != 'Linux'
run: |
python3 -m pip wheel . -w dist
for old in dist/rocketsim-*.whl
do
new=$(echo $old | sed -E 's/-(cp[0-9]+)-cp[0-9]+-/-cp36-abi3-/g')
mv $old $new
done
- name: Build extension for ${{ matrix.os }}
if: runner.os == 'Linux'
run: |
python3 -m cibuildwheel --output-dir dist
if [[ "${{ matrix.os }}" = "ubuntu-22.04-arm" ]]
then
arch="aarch64"
else
arch="x86_64"
fi
for old in dist/rocketsim-*.whl
do
new=$(echo $old | sed -E "s/-(cp[0-9]+)-cp[0-9]+-.*\\.whl/-cp36-abi3-manylinux_2_27_${arch}.whl/g")
mv $old $new
done
- uses: actions/upload-artifact@v6
with:
name: wheel-${{ runner.os }}-${{ runner.arch }}
path: dist/rocketsim-*.whl
test_wheel:
name: test-${{ matrix.os }}-python-${{ matrix.pyversion }}
runs-on: ${{ matrix.os }}
needs: build_wheel
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2025, ubuntu-22.04, ubuntu-22.04-arm, ubuntu-24.04, ubuntu-24.04-arm, macos-14, macos-15]
pyversion: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.pyversion }}
cache: 'pip'
- name: Install dependencies
run: |
pip3 install numpy PyGLM
- name: Download artifact ${{ matrix.os }}
uses: actions/download-artifact@v7
with:
name: wheel-${{ runner.os }}-${{ runner.arch }}
path: dist
- name: Install extension
shell: bash
run: |
pip3 install dist/rocketsim-*.whl
- name: Load collision meshes
uses: actions/cache/restore@v5
id: collision-cache-restore
with:
path: collision_meshes
key: collision-cache
enableCrossOsArchive: true
- name: Download collision meshes
if: steps.collision-cache-restore.outputs.cache-hit != 'true'
run: |
curl -o collision_meshes.tar ${{ secrets.COLLISION_MESHES_URL }}
tar -xf collision_meshes.tar
- name: Save collision meshes
if: steps.collision-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: collision_meshes
key: collision-cache
enableCrossOsArchive: true
- name: Run unit tests
run: |
python3 python-mtheall/unit_test.py
- name: Run regression tests
run: |
python3 python-mtheall/regression_test.py
publish_pypi:
name: Publish PyPI
runs-on: ubuntu-latest
needs: test_wheel
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/RocketSim
permissions:
id-token: write
steps:
- name: Download artifact Windows-X64
uses: actions/download-artifact@v7
with:
name: wheel-Windows-X64
path: dist
- name: Download artifact Linux-X64
uses: actions/download-artifact@v7
with:
name: wheel-Linux-X64
path: dist
- name: Download artifact Linux-ARM64
uses: actions/download-artifact@v7
with:
name: wheel-Linux-ARM64
path: dist
- name: Download artifact macOS-ARM64
uses: actions/download-artifact@v7
with:
name: wheel-macOS-ARM64
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1