From cb2be1a4a828d0706dedb458e5c8a31cc6548536 Mon Sep 17 00:00:00 2001 From: salopeknet <48922773+salopeknet@users.noreply.github.com> Date: Mon, 10 Jun 2024 05:36:53 +0200 Subject: [PATCH] Create crosscompiler.yml - 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 --- .github/workflows/crosscompiler.yml | 114 ++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 .github/workflows/crosscompiler.yml diff --git a/.github/workflows/crosscompiler.yml b/.github/workflows/crosscompiler.yml new file mode 100644 index 0000000..dc2845c --- /dev/null +++ b/.github/workflows/crosscompiler.yml @@ -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/Nuitka-Action@v1.0 + 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/zip-release@0.7.6 + 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/zip-release@0.7.6 + 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/zip-release@0.7.6 + 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}}.*