Skip to content

Commit

Permalink
Create crosscompiler.yml
Browse files Browse the repository at this point in the history
- New compiling method: Download as tar.gz archive (macOS & Linux) and as zip archive for Windows, no single-file
- so you shouldn't have to make the files executable any more
  • Loading branch information
salopeknet committed Jun 10, 2024
1 parent 4f2e8c9 commit cb2be1a
Showing 1 changed file with 114 additions and 0 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/crosscompiler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Cross-compile workflow that is manually triggered

name: Python-Cross-Compiler

on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
myname:
default: 'SIMrw'
description: Script name
type: string
required: true

mytag:
# Friendly description to be shown in the UI instead of 'name'
description: 'Input Tag'
# Default value if no value is explicitly provided
default: '0.0.0'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel

jobs:
build:
permissions:
contents: write
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{matrix.os}}

steps:
- name: Check-out repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: setup prerequisites from lr
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install libpcsclite-dev python3-all-dev python3-setuptools swig
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install swig
else
echo "$RUNNER_OS not supported"
fi
- name: Install Dependencies for All
run: |
pip install -r requirements.txt
- name: Build Executable for ${{runner.os}}
uses: Nuitka/[email protected]
with:
nuitka-version: 2.2.3
script-name: ${{github.event.inputs.myname}}.py
company-name: salopeknet
file-version: ${{github.event.inputs.mytag}}
onefile: false
output-file: ${{github.event.inputs.myname}}

- name: Make executable & compress TAR for macOS
if: runner.os == 'macOS'
uses: thedoctor0/[email protected]
with:
type: "tar"
command: "chmod +x build/${{github.event.inputs.myname}}.dist/${{github.event.inputs.myname}} && mv build/${{github.event.inputs.myname}}.dist ${{github.event.inputs.myname}}"
path: "${{github.event.inputs.myname}}"
filename: "${{github.event.inputs.myname}}-${{runner.os}}.tar.gz"

- name: Compress ZIP for Windows
if: runner.os == 'Windows'
uses: thedoctor0/[email protected]
with:
type: "zip"
command: "mv build/${{github.event.inputs.myname}}.dist ${{github.event.inputs.myname}}"
path: "${{github.event.inputs.myname}}"
filename: "${{github.event.inputs.myname}}-${{runner.os}}.zip"

- name: Make executable & compress TAR for Linux
if: runner.os == 'Linux'
uses: thedoctor0/[email protected]
with:
type: "tar"
command: "chmod +x build/${{github.event.inputs.myname}}.dist/${{github.event.inputs.myname}} && mv build/${{github.event.inputs.myname}}.dist ${{github.event.inputs.myname}}"
path: "${{github.event.inputs.myname}}"
filename: "${{github.event.inputs.myname}}-${{runner.os}}.tar.gz"

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{runner.os}} Build
if-no-files-found: warn
path: ${{github.event.inputs.myname}}-${{runner.os}}.*

- name: Create Release ${{github.event.inputs.mytag}} with Builds from Nuitka
uses: ncipollo/release-action@v1
with:
allowUpdates: true
commit: main
tag: ${{github.event.inputs.mytag}}
artifacts: ${{github.event.inputs.myname}}-${{runner.os}}.*

0 comments on commit cb2be1a

Please sign in to comment.