Skip to content

fix workflow for 64 bit build #220

fix workflow for 64 bit build

fix workflow for 64 bit build #220

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"
git pull
git push
exit(0) # exiting with '1' for some reason, so force proper exit
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.11
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
cp -r addon/globalPlugins/MathCAT/Rules Example
- name: create rules.zip
uses: thedoctor0/zip-release@0.7.5
with:
type: 'zip'
filename: '../Rules.zip'
directory: 'Example'
path: 'Rules'
- 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.11-win.zip'
directory: 'Example'
path: 'libmathcat_py.pyd'
# build the test after zipping up "Rules" because the test will unzip the files needed for the test
- name: test build
run: |
cd Example
python test.py
- name: Upload 64 bit pyd file
uses: actions/upload-artifact@v4
with:
name: libmathcat_py-64-3.11-win.zip
path: libmathcat_py-64-3.11-win.zip
compression-level: 0
retention-days: 1
- name: Upload Rules.zip
uses: actions/upload-artifact@v4
with:
name: Rules.zip
path: Rules.zip
compression-level: 0
retention-days: 1
rust-32:
name: build addon (and 32-bit windows pyd file)
needs: l10n
runs-on: windows-latest # needs to run on windows because no 32-bit python on linux
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: Set up addons dir
run: |
cp target/i686-pc-windows-msvc/release/libmathcat_py.dll addon/globalPlugins/MathCAT/libmathcat_py.pyd
sed 's/^import wx\.xrc/# import wx.xrc/' --in-place "addon/globalPlugins/MathCAT/MathCATgui.py" # fix wx file
- name: Upload addons dir to use with scons
uses: actions/upload-artifact@v4
with:
name: MathCAT_addons
path: addon/globalPlugins
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.11
architecture: 'x64'
- name: Build Rust Library
run: |
cargo build --target x86_64-unknown-linux-gnu --release
- name: Setup Example dir
run: |
ls -l target
ls -l target/target/x86_64-unknown-linux-gnu
ls -l target/target/x86_64-unknown-linux-gnu/release
cp target/x86_64-unknown-linux-gnu/release/libmathcat_py.dll Example/libmathcat_py.pyd
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.11-linux.zip'
directory: 'Example'
path: 'libmathcat_py.pyd'
# build the test after zipping up "Rules" because the test will unzip the files needed for the test
#
# - name: test build
# run: |
# cd Example
# python test.py
- name: Upload 64 bit pyd file
uses: actions/upload-artifact@v4
with:
name: libmathcat_py-64-3.11-linux.zip
path: libmathcat_py-64-3.11-linux.zip
compression-level: 0
retention-days: 1
pre-release:
name: Pre Release
continue-on-error: false
needs: [rust-64, rust-32]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- 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
# download the previous build artifacts and put them in their proper places
- name: Download 64 bit build
uses: actions/download-artifact@v4
with:
name: libmathcat_py-64-3.11-win.zip
- name: Download Rules.zip
uses: actions/download-artifact@v4
with:
name: Rules.zip
- name: Download MathCAT addons dir
uses: actions/download-artifact@v4
with:
name: MathCAT_addons
- shell: bash
run: cp -r MathCAT addon/globalPlugins
- name: create zip file for standalone 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: 'addon/globalPlugins/MathCAT'
path: 'libmathcat_py.pyd'
# finally, 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.11-win.zip
Rules.zip