Skip to content

Build Karbon and Release #30

Build Karbon and Release

Build Karbon and Release #30

Workflow file for this run

name: Build Karbon and Release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [windows-latest, ubuntu-22.04, macos-latest] # original
os: [windows-latest] # ✅ Only build on Windows
include:
- os: windows-latest
extension: .exe
pyinstaller-args: "--onefile --noconsole --name Karbon --icon=icon.ico"
# - os: ubuntu-22.04
# extension: ''
# pyinstaller-args: "--onefile --name Karbon"
# - os: macos-latest
# extension: .app
# pyinstaller-args: "--onefile --windowed --name Karbon"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
# - name: Install system dependencies for Linux
# if: matrix.os == 'ubuntu-22.04'
# run: |
# sudo apt-get update
# sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev python3-tk pkg-config
# - name: Install system dependencies for macOS
# if: matrix.os == 'macos-latest'
# run: |
# brew update
# brew install gtk+3 webkitgtk pkg-config
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Install test dependencies
run: |
pip install pytest pytest-cov coverage
- name: Run tests with coverage and JUnit report
run: |
pytest --cov=. --cov-report=xml --junitxml=pytest-report.xml
- name: Build executable with PyInstaller
run: |
python -m PyInstaller ui.py ${{ matrix.pyinstaller-args }}
- name: Rename binary for upload
shell: bash
run: |
mkdir -p upload
cp "dist/Karbon${{ matrix.extension }}" "upload/Karbon-${{ runner.os }}${{ matrix.extension }}"
# - name: Zip output for Linux/macOS
# if: matrix.os != 'windows-latest'
# run: |
# cd upload
# zip -r Karbon-${{ runner.os }}.zip ./*
- name: Get short commit hash
id: vars
shell: bash
run: echo "SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: "build-${{ env.SHORT_SHA }}"
name: "Karbon Build ${{ env.SHORT_SHA }}"
draft: false
prerelease: false
files: |
upload/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build artifacts (backup)
uses: actions/upload-artifact@v4
with:
name: karbon-${{ runner.os }}
path: upload/*