Skip to content

Commit 7da84f7

Browse files
authored
Automated build (#383)
* fix version * qfix * pyhton tools * python virtual env * wheels issues * patches * setuptools * patch * tokens and ev variables fix * qfix * fuck apple * linux fix * fix linux * fix linux arm * pacman removed * qfix * fixed path * fix mac arm * fix arch * clenn up chain * macos13 * node version * fix python version * overwrite * src * gyp fix * contrib update * update tests * fix image test
1 parent 065ef0e commit 7da84f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+458
-76
lines changed

.github/workflows/build-linux.yml

+107-30
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,56 @@ jobs:
2525
- uses: actions/checkout@v4
2626
with:
2727
fetch-depth: 0
28-
token: ${{ secrets.GH_TOKEN }}
28+
token: ${{ secrets.GH_TOKEN }}
2929

30-
- name: Compile function
30+
31+
- name: Set up Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '23'
35+
36+
37+
- name: Patch specific dependencies from package.json
38+
run: |
39+
cat << 'EOF' > clean-package-json.js
40+
const fs = require('fs');
41+
const path = './package.json';
42+
43+
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
44+
45+
const depsToRemove = [
46+
"dmg-license",
47+
"electron-trackpad-utils"
48+
];
49+
50+
['dependencies', 'devDependencies'].forEach(section => {
51+
if (pkg[section]) {
52+
depsToRemove.forEach(dep => {
53+
delete pkg[section][dep];
54+
});
55+
}
56+
});
57+
58+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
59+
EOF
60+
61+
node clean-package-json.js
62+
rm clean-package-json.js
63+
64+
- name: Install dependencies
65+
run: npm install
66+
67+
- name: Bundle
3168
env:
3269
WOLFRAMSCRIPT_ENTITLEMENTID: ${{ secrets.WOLFRAM_LICENSE_ENTITLEMENT_ID }}
3370
run: |
34-
wolframscript -script ./Scripts/BuildLibrary.wls /usr/include/ /usr/lib/x86_64-linux-gnu/libuv.so
71+
npm run pre-dist
72+
73+
- name: Build electron
74+
env:
75+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
76+
run: npm run dist-linux86
3577

36-
- name: Commit files
37-
run: |
38-
git config pull.rebase false
39-
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
40-
git config --local user.name "github-actions[bot]"
41-
git add LibraryResources/
42-
git add UV/
43-
git commit -m "Add binary for ${{ env.WOLFRAM_SYSTEM_ID }}"
44-
git pull
45-
git push
4678

4779
build-ARM:
4880
runs-on: ubuntu-24.04-arm
@@ -52,7 +84,7 @@ jobs:
5284
WOLFRAMENGINE_INSTALLATION_DIRECTORY: "/Applications/Wolfram Engine.app"
5385
steps:
5486
- name: Check out repository
55-
uses: actions/checkout@v2
87+
uses: actions/checkout@v4
5688
with:
5789
token: ${{ secrets.GH_TOKEN }}
5890

@@ -64,25 +96,70 @@ jobs:
6496
sudo apt install libuv1-dev -y
6597
6698
67-
- name: Compile function
99+
- name: Set up Node.js
100+
uses: actions/setup-node@v4
101+
with:
102+
node-version: '23'
103+
104+
105+
- name: Patch specific dependencies from package.json
106+
run: |
107+
cat << 'EOF' > clean-package-json.js
108+
const fs = require('fs');
109+
const path = './package.json';
110+
111+
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
112+
113+
const depsToRemove = [
114+
"dmg-license",
115+
"electron-trackpad-utils"
116+
];
117+
118+
['dependencies', 'devDependencies'].forEach(section => {
119+
if (pkg[section]) {
120+
depsToRemove.forEach(dep => {
121+
delete pkg[section][dep];
122+
});
123+
}
124+
});
125+
126+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
127+
EOF
128+
129+
node clean-package-json.js
130+
rm clean-package-json.js
131+
132+
- name: Install dependencies
133+
run: npm install
134+
135+
- name: Bundle
68136
env:
69137
WOLFRAMSCRIPT_ENTITLEMENTID: ${{ secrets.WOLFRAM_LICENSE_ENTITLEMENT_ID }}
70138
run: |
71-
/opt/Wolfram/WolframEngine/14.1/SystemFiles/Kernel/Binaries/Linux-ARM64/wolframscript -debug -verbose -script ./Scripts/BuildLibrary.wls /usr/include /usr/lib/aarch64-linux-gnu/libuv.so
139+
/opt/Wolfram/WolframEngine/14.1/SystemFiles/Kernel/Binaries/Linux-ARM64/wolframscript -debug -verbose -script ./Scripts/bundle.wls
72140
141+
- name: Install Ruby and dependencies
142+
run: |
143+
sudo apt-get update
144+
sudo apt-get install -y ruby ruby-dev build-essential
73145
74-
- name: Commit files
146+
- name: Install FPM gem
75147
run: |
76-
git config pull.rebase true
77-
git fetch
78-
git pull
79-
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
80-
git config --local user.name "github-actions[bot]"
81-
git add LibraryResources/
82-
git add UV/
83-
git commit -m "Add binary for ${{ env.WOLFRAM_SYSTEM_ID }}"
84-
- name: Push changes
85-
uses: ad-m/github-push-action@master
86-
with:
87-
github_token: ${{ secrets.GH_TOKEN }}
88-
branch: ${{ github.ref }}
148+
sudo gem install fpm
149+
150+
- name: Set up Ruby environment
151+
run: |
152+
echo "USE_SYSTEM_FPM=true" >> $GITHUB_ENV
153+
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
154+
echo "GEM_HOME=$GEM_HOME" >> $GITHUB_ENV
155+
echo "$GEM_HOME/bin" >> $GITHUB_PATH
156+
157+
- name: Display Ruby and FPM info
158+
run: |
159+
echo "Ruby version: $(ruby -v)"
160+
echo "FPM version: $(fpm --version)"
161+
162+
- name: Build electron
163+
env:
164+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
165+
run: npm run dist-linux

.github/workflows/build-mac.yml

+146-30
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@ jobs:
1313
with:
1414
token: ${{ secrets.GH_TOKEN }}
1515

16-
- name: Cache/restore Wolfram Engine install
17-
id: cache-restore
18-
uses: actions/cache@v2
19-
with:
20-
path: ${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}
21-
key: wolframengine-${{ env.WOLFRAM_SYSTEM_ID }}-${{ env.WOLFRAMENGINE_CACHE_KEY }}
2216

23-
- name: Install Wolfram Engine
24-
if: steps.cache-restore.outputs.cache-hit != 'true'
17+
18+
- name: Install Python 3.11
2519
run: |
26-
echo 'Installing Wolfram Engine...'
27-
brew install --cask wolfram-engine
28-
brew install libuv
29-
echo 'Installed Wolfram Engine.'
20+
brew install [email protected]
21+
echo "/opt/homebrew/opt/[email protected]/bin" >> $GITHUB_PATH
22+
echo "PYTHON=/opt/homebrew/opt/[email protected]/bin/python3.11" >> $GITHUB_ENV
23+
24+
- name: Check Python version
25+
run: |
26+
python3.11 -V
27+
which python3.11
3028
3129
- name: Set up Node.js
3230
uses: actions/setup-node@v4
@@ -39,9 +37,61 @@ jobs:
3937
node -v
4038
npm -v
4139
42-
- name: Install dependencies
43-
run: /
44-
npm i
40+
- name: Create Python virtual environment
41+
run: |
42+
python3.11 -m venv venv
43+
source venv/bin/activate
44+
pip install --upgrade pip setuptools wheel
45+
46+
- name: Install Node.js dependencies
47+
run: |
48+
source venv/bin/activate
49+
npm install
50+
51+
- name: Install the Apple certificate and provisioning profile
52+
env:
53+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
54+
BUILD_CERTIFICATE_PASSWORD: ${{ secrets.BUILD_CERTIFICATE_PASSWORD }}
55+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
56+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
57+
APPLE_ID: ${{ secrets.APPLE_ID }}
58+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
59+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
60+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
61+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
62+
run: |
63+
# Create variables
64+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
65+
PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
66+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
67+
68+
# Import certificate and provisioning profile from secrets
69+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
70+
71+
# Create temporary keychain
72+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
73+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
74+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
75+
76+
# Import certificate to keychain
77+
security import $CERTIFICATE_PATH -P "$BUILD_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
78+
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
79+
security list-keychain -d user -s $KEYCHAIN_PATH
80+
81+
- name: Cache/restore Wolfram Engine install
82+
id: cache-restore
83+
uses: actions/cache@v4
84+
with:
85+
path: ${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}
86+
key: wolframengine-${{ env.WOLFRAM_SYSTEM_ID }}-${{ env.WOLFRAMENGINE_CACHE_KEY }}
87+
88+
- name: Install Wolfram Engine
89+
if: steps.cache-restore.outputs.cache-hit != 'true'
90+
run: |
91+
echo 'Installing Wolfram Engine...'
92+
brew install --cask wolfram-engine
93+
brew install libuv
94+
echo 'Installed Wolfram Engine.'
4595
4696
- name: Prepare bundle
4797
env:
@@ -54,9 +104,19 @@ jobs:
54104
55105
56106
- name: Build electron
107+
env:
108+
APPLE_ID: ${{ secrets.APPLE_ID }}
109+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
110+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
111+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
112+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
57113
run: |
58114
npm run dist-mac
59115
116+
- name: Clean up keychain and provisioning profile
117+
run: |
118+
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
119+
60120
61121
build-MacOSX-x64:
62122
runs-on: macos-13
@@ -70,9 +130,68 @@ jobs:
70130
with:
71131
token: ${{ secrets.GH_TOKEN }}
72132

133+
- name: Install Python 3.11 (for node-gyp)
134+
run: |
135+
brew install [email protected] || true
136+
/usr/local/opt/[email protected]/bin/python3.11 -m ensurepip
137+
/usr/local/opt/[email protected]/bin/python3.11 -m pip install setuptools
138+
echo "/usr/local/opt/[email protected]/bin" >> $GITHUB_PATH
139+
echo "PYTHON=/usr/local/opt/[email protected]/bin/python3.11" >> $GITHUB_ENV
140+
141+
- name: Check Python version
142+
run: |
143+
python3.11 -V
144+
which python3.11
145+
146+
- name: Set up Node.js
147+
uses: actions/setup-node@v4
148+
with:
149+
node-version: '20.19.0'
150+
architecture: 'x64'
151+
152+
- name: Verify Node.js
153+
run: |
154+
node -v
155+
npm -v
156+
157+
- name: Install Node.js dependencies
158+
run: |
159+
npm install
160+
161+
- name: Install the Apple certificate and provisioning profile
162+
env:
163+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
164+
BUILD_CERTIFICATE_PASSWORD: ${{ secrets.BUILD_CERTIFICATE_PASSWORD }}
165+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
166+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
167+
APPLE_ID: ${{ secrets.APPLE_ID }}
168+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
169+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
170+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
171+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
172+
run: |
173+
# Create variables
174+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
175+
PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
176+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
177+
178+
# Import certificate and provisioning profile from secrets
179+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
180+
181+
# Create temporary keychain
182+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
183+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
184+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
185+
186+
# Import certificate to keychain
187+
security import $CERTIFICATE_PATH -P "$BUILD_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
188+
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
189+
security list-keychain -d user -s $KEYCHAIN_PATH
190+
191+
73192
- name: Cache/restore Wolfram Engine install
74193
id: cache-restore
75-
uses: actions/cache@v2
194+
uses: actions/cache@v4
76195
with:
77196
path: ${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}
78197
key: wolframengine-${{ env.WOLFRAM_SYSTEM_ID }}-${{ env.WOLFRAMENGINE_CACHE_KEY }}
@@ -85,20 +204,7 @@ jobs:
85204
brew install libuv
86205
echo 'Installed Wolfram Engine.'
87206
88-
- name: Set up Node.js
89-
uses: actions/setup-node@v4
90-
with:
91-
node-version: '23' # or '25', etc.
92-
architecture: 'x86'
93-
94-
- name: Verify Node.js
95-
run: |
96-
node -v
97-
npm -v
98207
99-
- name: Install dependencies
100-
run: /
101-
npm i
102208
103209
- name: Bundle files
104210
env:
@@ -110,5 +216,15 @@ jobs:
110216
npm run pre-dist
111217
112218
- name: Build electron
219+
env:
220+
APPLE_ID: ${{ secrets.APPLE_ID }}
221+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
222+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
223+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
224+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
225+
run: |
226+
npm run dist-mac86
227+
228+
- name: Clean up keychain and provisioning profile
113229
run: |
114-
npm run dist-mac86
230+
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db

0 commit comments

Comments
 (0)