From 842dfbbe48dfce1b3c387402d7bea803ce97ef8f Mon Sep 17 00:00:00 2001 From: Mark Finn Date: Mon, 15 Jan 2024 12:30:19 -0600 Subject: [PATCH] create linux and windows executables on github using actions --- .github/workflows/release.yml | 58 +++++++++++++++++++++++++++++++++++ make_metric_gcode.spec | 37 ++++++++++++++++++++++ readme.md | 16 +++++++--- 3 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 make_metric_gcode.spec diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..36c4649 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Make Release +run-name: ${{ github.actor }} build and publishrelease linux 🚀 +on: + release: + types: [published] +jobs: + Create-Release-Linux: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Get Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: Create executable + run: | + #cd ${{ github.workspace }} + python -m venv venv + . venv/bin/activate + pip install -r requirements.txt + pip install -r build_requirements.txt + pyinstaller -F guimain.py -n make_metric_gcode + - run: mv dist/make_metric_gcode dist/make_metric_gcode.linux + - name: Add Release artifact + uses: softprops/action-gh-release@v1 + with: + files: dist/make_metric_gcode.linux + body: GUI executable built with pyinstaller + - run: echo "🍏 This job's status is ${{ job.status }}." + + Create-Release-Windows: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Get Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: pyinstaller-windows + uses: JackMcKew/pyinstaller-action-windows@python3-10-pyinstaller-5-3 + with: + path: . + - name: Add Release artifact + uses: softprops/action-gh-release@v1 + with: + files: dist/windows/make_metric_gcode.exe diff --git a/make_metric_gcode.spec b/make_metric_gcode.spec new file mode 100644 index 0000000..97109a0 --- /dev/null +++ b/make_metric_gcode.spec @@ -0,0 +1,37 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['guimain.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.datas, + [], + name='make_metric_gcode', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) diff --git a/readme.md b/readme.md index 4475c02..eac794a 100644 --- a/readme.md +++ b/readme.md @@ -14,8 +14,9 @@ Comments are currently lost in the output because I'm lazy. # Install -I'm going to try to make releases that are precompiled, but until then: +Just download and run the releases built on github. https://github.com/Brown-County-FIRST-Robotics/MakeMetricGcode/releases/latest +## If you downloaded the source ```bash git clone git@github.com:Brown-County-FIRST-Robotics/MakeMetricGcode.git cd MakeMetricGcode @@ -25,23 +26,28 @@ pip install -r requirements.txt ``` # Run +If you have a downloaded release executable just run it + +## If you downloaded the source ```bash python guimain.py ``` # Build +## Using github actions to make a release with windows and linux asssets +create a release in github. A workflow in .github/workflows/release.yml will build the artifacts and stick them on the release ## Linux ```bash . venv/bin/activate +pip install -r requirements.txt pip install -r build_requirements.txt -python pyinstaller -F guimain.py -n make_metric_gcode +pyinstaller -F guimain.py -n make_metric_gcode ``` - # Todo -- [ ] build linux release -- [ ] build windows release +- [x] build linux release +- [x] build windows release - [ ] build mac release - [ ] better GUI style: https://www.reddit.com/r/Python/comments/lps11c/how_to_make_tkinter_look_modern_how_to_use_themes/ - [ ] stop using easygui or fix the extension ordering in file open and save dialog