More fixes #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automatic CipherOS Builder | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test-and-build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
arch: [x64, arm64, x32] | |
exclude: | |
- os: windows-latest | |
arch: arm64 | |
- os: windows-latest | |
arch: x32 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.13.1' | |
- name: Install Inno Setup | |
if: runner.os == 'Windows' | |
run: | | |
choco install innosetup -y | |
shell: cmd | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt pyinstaller | |
- name: Detect Architecture | |
run: echo "Running on $RUNNER_OS with architecture $RUNNER_ARCH" | |
shell: bash | |
- name: Run Compilation Script | |
shell: bash | |
run: | | |
OUTPUT_DIR="distworkflow" | |
mkdir -p "$OUTPUT_DIR" | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
echo "Compiling for Windows (${RUNNER_ARCH})..." | |
pyinstaller main.py --distpath "$OUTPUT_DIR" --onefile --icon="./icon.ico" --name="cipheros" | |
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
echo "Compiling for Linux (${RUNNER_ARCH})..." | |
pyinstaller main.py --distpath "$OUTPUT_DIR" --onefile --icon="./icon.ico" --name="cipheros" | |
chmod +x $OUTPUT_DIR/cipheros | |
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
echo "Compiling for macOS (${RUNNER_ARCH})..." | |
pyinstaller main.py --distpath "$OUTPUT_DIR" --onefile --icon="./icon.ico" --name="cipheros" | |
chmod +x $OUTPUT_DIR/cipheros | |
fi | |
- name: Test Initialization | |
shell: bash | |
run: | | |
EXECUTABLE="distworkflow/cipheros" | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
EXECUTABLE="${EXECUTABLE}.exe" | |
fi | |
if [[ ! -f "$EXECUTABLE" ]]; then | |
echo "Error: Compiled executable not found!" | |
exit 1 | |
fi | |
$EXECUTABLE --debug --startdir=. || (echo "Error: Program failed during initialization!" && exit 1) | |
- name: Package with Inno Setup | |
if: runner.os == 'Windows' | |
run: | | |
# Detect architecture more reliably | |
$arch = if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64" -and $env:ProgramFiles -match "x86") { "x32" } | |
elseif ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") { "x64" } | |
else { "x32" } | |
# Set the path to the ISS file based on architecture | |
$issFile = if ($arch -eq "x64") { "installer_x64.iss" } else { "installer_x32.iss" } | |
# Run the Inno Setup Compiler | |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" $issFile | |
shell: pwsh | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "${{ matrix.os }}-${{ matrix.arch }}-build" | |
path: "distworkflow" | |