-
Notifications
You must be signed in to change notification settings - Fork 9
256 lines (248 loc) · 8.15 KB
/
automaticRelease.yaml
File metadata and controls
256 lines (248 loc) · 8.15 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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
name: automatic-release
on:
push:
branches:
- main
# schedule:
# # * is a special character in YAML so you have to quote this string
# - cron: '0 0 * * 6'
jobs:
l10n:
name: l10n
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Push l10n updates
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git remote add l10n https://github.com/nvdaaddons/MathCAT
git fetch l10n
git reset l10n/stable addon/doc addon/locale
git commit -m "Update translations" --allow-empty
git pull
git push
zip-rules:
name: zip up the rules directory
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build Rust Library
run: |
cargo build --target x86_64-unknown-linux-gnu # doesn't need a release build since all that we want is the Rules dir
- name: create rules.zip
uses: thedoctor0/zip-release@0.7.5
with:
type: 'zip'
filename: 'Rules.zip'
directory: 'addon/globalPlugins/MathCAT'
path: 'Rules'
- name: Upload Rules.zip
uses: actions/upload-artifact@v4
with:
name: 'Rules.zip'
path: 'addon/globalPlugins/MathCAT/Rules.zip'
compression-level: 0
retention-days: 1
rust-32:
name: Build 32 bit windows pyd file
runs-on: windows-latest # needs to run on windows because of bzip2
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
architecture: 'x86'
- name: Build Rust Library
run: |
cargo build --target i686-pc-windows-msvc --release
- name: Setup Example dir
run: |
cp target/i686-pc-windows-msvc/release/libmathcat_py.dll Example/libmathcat_py.pyd
mv addon/globalPlugins/MathCAT/Rules Example
- name: test the build
run: |
cd Example
python test.py
- name: create zip file for pyd file -- this allows the name to indicate arch, python version, etc., but unzipped it is correctly named
uses: thedoctor0/zip-release@0.7.5
with:
type: 'zip'
filename: '../libmathcat_py-32-3.11-win.zip'
directory: 'Example'
path: 'libmathcat_py.pyd'
- name: Upload 32 bit pyd file
uses: actions/upload-artifact@v4
with:
name: libmathcat_py-32-3.11-win.zip
path: libmathcat_py-32-3.11-win.zip
compression-level: 0
retention-days: 1
rust-64:
name: Build 64 bit windows pyd file
runs-on: windows-latest # needs to run on windows because of bzip2
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
architecture: 'x64'
- name: Build Rust Library
run: |
cargo build --target x86_64-pc-windows-msvc --release
- name: Setup Example dir
run: |
cp target/x86_64-pc-windows-msvc/release/libmathcat_py.dll Example/libmathcat_py.pyd
mv addon/globalPlugins/MathCAT/Rules Example
- name: create zip file for pyd file -- this allows the name to indicate arch, python version, etc., but unzipped it is correctly named
uses: thedoctor0/zip-release@0.7.5
with:
type: 'zip'
filename: '../libmathcat_py-64-3.13-win.zip'
directory: 'Example'
path: 'libmathcat_py.pyd'
- name: test the build
run: |
cd Example
python test.py
- name: Upload 64 bit pyd file
uses: actions/upload-artifact@v4
with:
name: libmathcat_py-64-3.13-win.zip
path: libmathcat_py-64-3.13-win.zip
compression-level: 0
retention-days: 1
linux-64:
name: Build linux pyd file (64-bit intel)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
architecture: 'x64'
- name: Build Rust Library
run: |
cargo build --target x86_64-unknown-linux-gnu --release
- name: Setup Example dir
run: |
# don't know why it is "liblib...". For consistancy with other versions, it is renamed.
cp target/x86_64-unknown-linux-gnu/release/liblibmathcat_py.so Example/libmathcat_py.so
cp -r addon/globalPlugins/MathCAT/Rules Example
- name: test build
run: |
cd Example
python test.py
- name: create zip file for pyd file -- this allows the name to indicate arch, python version, etc., but unzipped it is correctly named
uses: thedoctor0/zip-release@0.7.5
with:
type: 'zip'
filename: '../libmathcat_py-64-3.13-linux.zip'
directory: 'Example'
path: 'libmathcat_py.so'
- name: Upload 64 bit pyd file
uses: actions/upload-artifact@v4
with:
name: libmathcat_py-64-3.13-linux.zip
path: libmathcat_py-64-3.13-linux.zip
compression-level: 0
retention-days: 1
build-addon:
name: build-addon
continue-on-error: false
needs: [l10n, zip-rules, rust-32]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# download the 32 build
- name: Download 32 bit build
uses: actions/download-artifact@v4
with:
name: libmathcat_py-32-3.11-win.zip
# download the Rules dir (not part of checkout)
- name: Download 32 bit build
uses: actions/download-artifact@v4
with:
name: Rules.zip
# put things where they belong
- name: Set up addons dir
run: |
unzip libmathcat_py-32-3.11-win.zip
mv libmathcat_py.pyd Rules.zip addon/globalPlugins/MathCAT
cd addon/globalPlugins/MathCAT
sed 's/^import wx\.xrc/# import wx.xrc/' --in-place MathCATgui.py # fix wx file
unzip Rules.zip
rm Rules.zip
# build the addon
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11 # needed for scons
- name: Install scons dependencies
run: |
pip install scons markdown
sudo apt update
sudo apt install gettext
- name: Run scons to build .addon file
run: |
scons
- name: Upload the addon
uses: actions/upload-artifact@v4
with:
name: addon
path: "*.nvda-addon"
compression-level: 0
retention-days: 1
pre-release:
name: Pre Release
continue-on-error: false
needs: [zip-rules, rust-32, rust-64, linux-64, build-addon]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# download the previous build artifacts and put them in their proper places
- name: Download Rules.zip
uses: actions/download-artifact@v4
with:
name: Rules.zip
- name: Download 32 bit build
uses: actions/download-artifact@v4
with:
name: libmathcat_py-32-3.11-win.zip
- name: Download 64 bit build
uses: actions/download-artifact@v4
with:
name: libmathcat_py-64-3.13-win.zip
- name: Download 64 bit linux build
uses: actions/download-artifact@v4
with:
name: libmathcat_py-64-3.13-linux.zip
- name: download the addon
uses: actions/download-artifact@v4
with:
name: addon
# put the files into the release
- name: Automatic release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: latest
prerelease: true
title: Development Build
files: |
*.nvda-addon
libmathcat_py-32-3.11-win.zip
libmathcat_py-64-3.13-win.zip
libmathcat_py-64-3.13-linux.zip
Rules.zip