Skip to content

Build for GNULinux #227

Build for GNULinux

Build for GNULinux #227

Workflow file for this run

name: Build for GNULinux
on: workflow_dispatch
jobs:
build-x86:
runs-on: ubuntu-latest
env:
WOLFRAM_SYSTEM_ID: Linux-x86-64-v8
EP_GH_IGNORE_TIME: true
steps:
- name: Install build tools
run: |
sudo apt-get -y update
sudo apt-get -y install build-essential
sudo apt-get -y install libuv1-dev
- name: Install Git in container
run: |
sudo apt-get -y update
sudo apt-get -y install git
# one time fix to avoid permission problems later on
git config --global --add safe.directory "$GITHUB_WORKSPACE"
# Checks-out the repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '23'
- name: Patch specific dependencies from package.json
run: |
cat << 'EOF' > clean-package-json.js
const fs = require('fs');
const path = './package.json';
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
const depsToRemove = [
"dmg-license",
"electron-trackpad-utils"
];
['dependencies', 'devDependencies'].forEach(section => {
if (pkg[section]) {
depsToRemove.forEach(dep => {
delete pkg[section][dep];
});
}
});
const forcedVersions = {
};
[ 'devDependencies' ] . forEach( section => {
if ( ! pkg [ section ]) {
pkg [ section ] = {};
}
Object . entries( forcedVersions ) . forEach(([ dep , version ]) => {
pkg [ section ][ dep ] = version ; // always enforce version
console.log('!!! Downgrading electron version');
});
});
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
EOF
node clean-package-json.js
rm clean-package-json.js
- name: Install dependencies
run: npm install
- name: Build electron
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: npm run dist-linux86
build-RPM-x86:
runs-on: ubuntu-latest
env:
WOLFRAM_SYSTEM_ID: Linux-x86-64-v8
steps:
- name: Install build tools
run: |
sudo apt-get -y update
sudo apt-get -y install build-essential libuv1-dev rpm ruby ruby-dev xz-utils
- name: Install FPM
run: sudo gem install fpm
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '23'
- name: Patch platform-specific dependencies
run: |
node << 'EOF'
const fs = require('fs');
const path = './package.json';
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
for (const section of ['dependencies', 'devDependencies', 'optionalDependencies']) {
if (!pkg[section]) continue;
delete pkg[section]['dmg-license'];
delete pkg[section]['electron-trackpad-utils'];
}
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
EOF
- name: Install dependencies
run: npm install
- name: Build and publish RPM
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
USE_SYSTEM_FPM: true
run: npm run dist-linux-rpm86
- name: Verify installation on openSUSE Leap 16.0
run: |
docker run --rm \
--volume "$PWD/dist:/packages:ro" \
opensuse/leap:16.0 \
bash -euc '
rpm_files=(/packages/*.rpm)
rpm_path=${rpm_files[0]}
test -f "$rpm_path"
zypper --non-interactive --no-gpg-checks install --no-recommends "$rpm_path"
package_name=$(rpm -qp --queryformat "%{NAME}" "$rpm_path")
rpm -q "$package_name"
'
- name: Upload RPM artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: wljs-notebook-rpm-x86_64
path: dist/*.rpm
if-no-files-found: error
build-ARM:
runs-on: ubuntu-24.04-arm
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '23'
- name: Patch specific dependencies from package.json
run: |
cat << 'EOF' > clean-package-json.js
const fs = require('fs');
const path = './package.json';
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
const depsToRemove = [
"dmg-license",
"electron-trackpad-utils"
];
['dependencies', 'devDependencies'].forEach(section => {
if (pkg[section]) {
depsToRemove.forEach(dep => {
delete pkg[section][dep];
});
}
});
const forcedVersions = {
};
[ 'devDependencies' ] . forEach( section => {
if ( ! pkg [ section ]) {
pkg [ section ] = {};
}
Object . entries( forcedVersions ) . forEach(([ dep , version ]) => {
pkg [ section ][ dep ] = version ; // always enforce version
console.log('!!! Downgrading electron version');
});
});
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
EOF
node clean-package-json.js
rm clean-package-json.js
- name: Install dependencies
run: npm install
- name: Install Ruby and dependencies
run: |
sudo apt-get update
sudo apt-get install -y ruby ruby-dev build-essential
- name: Install FPM gem
run: |
sudo gem install fpm
- name: Set up Ruby environment
run: |
echo "USE_SYSTEM_FPM=true" >> $GITHUB_ENV
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
echo "GEM_HOME=$GEM_HOME" >> $GITHUB_ENV
echo "$GEM_HOME/bin" >> $GITHUB_PATH
- name: Display Ruby and FPM info
run: |
echo "Ruby version: $(ruby -v)"
echo "FPM version: $(fpm --version)"
- name: Build electron
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: npm run dist-linux