Skip to content

Switch to NSIS installer for future auto-update compatibility #14

Switch to NSIS installer for future auto-update compatibility

Switch to NSIS installer for future auto-update compatibility #14

name: Build and Export Executable
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
# Allows each OS to run separately without crashing each other
continue-on-error: true
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Set up Python 3.12 environment on all platforms
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
# Set up Node 18
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: thoth_front_end/package-lock.json
# Install C++ Compiler
- name: Install C++ Compiler on Linux
if: runner.os == 'Linux'
run: sudo apt-get install g++ -y
- name: Install C++ Compiler on macOS
if: runner.os == 'macOS'
run: brew install gcc
- name: Install C++ Compiler on Windows
if: runner.os == 'Windows'
run: |
choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --includeRecommended --includeOptional --quiet --norestart"
# Create Python virtual environment
- name: Set up Python Virtual Environment
run: |
python -m venv thoth_back_end/.venv
# Install dependencies using the virtual environment's pip
- name: Install Python dependencies (Posix)
if: runner.os != 'Windows'
run: |
thoth_back_end/.venv/bin/pip install -r thoth_back_end/requirements.txt
shell: bash
- name: Install Python dependencies (Windows)
if: runner.os == 'Windows'
run: |
thoth_back_end\.venv\Scripts\pip install -r thoth_back_end\requirements.txt
# Run the build script
- name: Build Executable (Posix)
if: runner.os != 'Windows'
working-directory: thoth_back_end
run: |
.venv/bin/python build_executable.py
shell: bash
- name: Build Executable (Windows)
if: runner.os == 'Windows'
working-directory: thoth_back_end
run: |
.venv\Scripts\python build_executable.py
- name: Strip down backend build (Posix)
if: runner.os != 'Windows'
working-directory: thoth_back_end
run: for dir in */; do [ "$dir" != "dist/" ] && rm -rf "$dir"; done
- name: Strip down backend build (Windows)
if: runner.os == 'Windows'
working-directory: thoth_back_end
run: |
Get-ChildItem -Directory | ForEach-Object {
if ($_.Name -ne "dist") {
Remove-Item $_.FullName -Recurse -Force
}
}
- name: Install npm dependencies
working-directory: thoth_front_end
run: npm i
- name: Build front-end executable (Linux)
if: runner.os == 'Linux'
working-directory: thoth_front_end
run: npm run make-linux
- name: Build front-end executable (macOS)
if: runner.os == 'macOS'
working-directory: thoth_front_end
run: npm run make-macos
- name: Build front-end executable (Windows)
if: runner.os == 'Windows'
working-directory: thoth_front_end
run: npm run make-windows
# Archive the build artifacts
- name: Archive Artifacts
uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.os }}
path: thoth_front_end/dist