Skip to content

Add more logging and fix metadata borkedness #11

Add more logging and fix metadata borkedness

Add more logging and fix metadata borkedness #11

Workflow file for this run

name: build and release application
on:
push:
tags:
- '*'
jobs:
build:
continue-on-error: true
name: build and release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifact_name: motec_log_gui-windows
nuitka_py: .\\motec_log_gui.py
- os: windows-11-arm
artifact_name: motec_log_gui-arm-windows
nuitka_py: .\\motec_log_gui.py
- os: ubuntu-latest
artifact_name: motec_log_gui-linux
nuitka_py: ./motec_log_gui.py
- os: macos-latest
artifact_name: motec_log_gui-macos
nuitka_py: ./motec_log_gui.py
- os: ubuntu-24.04-arm
artifact_name: motec_log_gui-arm-linux
nuitka_py: ./motec_log_gui.py
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
- name: install tkinter ubuntu
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
run: |
sudo apt-get update
sudo apt-get install -y python3-tk
- name: install tkinter macos
if: matrix.os == 'macos-latest'
run: |
brew install python-tk
- name: generate arg for the icon
id: icon_arg
run: |
if [ "${{ matrix.os }}" = "windows-latest" ] || [ "${{ matrix.os }}" = "windows-11-arm" ]; then
echo "icon_arg=--windows-icon-from-ico=./icons/squirrel.png" >> $GITHUB_OUTPUT
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
echo "icon_arg=--macos-app-icon=./icons/squirrel.png" >> $GITHUB_OUTPUT
elif [ "${{ matrix.os }}" = "ubuntu-latest" ] || [ "${{ matrix.os }}" = "ubuntu-24.04-arm" ]; then
echo "icon_arg=--linux-icon=./icons/squirrel.png" >> $GITHUB_OUTPUT
else
echo "icon_arg=" >> $GITHUB_OUTPUT
fi
shell: bash
- name: sync project deps
run: uv sync
- name: build standalone exe
id: build_exe
run: |
start_time=$(date +%s)
uv run python -m nuitka --standalone ${{ matrix.nuitka_py }} --enable-plugin=tk-inter --assume-yes-for-downloads --file-version=${{ github.ref_name }} --company-name="mathbrookie" --product-name="motec-log-gui" ${{ steps.icon_arg.outputs.icon_arg }}
end_time=$(date +%s)
build_time=$((end_time - start_time))
echo "build_time=$build_time" >> $GITHUB_OUTPUT
shell: bash
- name: Archive build output
id: archive
run: |
uncompressed_size=$(du -sh motec_log_gui.dist | cut -f1)
if [ "${{ matrix.os }}" = "windows-latest" ] || [ "${{ matrix.os }}" = "windows-11-arm" ]; then
7z a ${{ matrix.artifact_name }}.zip ./motec_log_gui.dist/*
archive_name="${{ matrix.artifact_name }}.zip"
compressed_size=$(du -sh $archive_name | cut -f1)
else
tar -czvf ${{ matrix.artifact_name }}.tar.gz -C motec_log_gui.dist .
archive_name="${{ matrix.artifact_name }}.tar.gz"
compressed_size=$(du -sh $archive_name | cut -f1)
fi
echo "archive_name=$archive_name" >> $GITHUB_OUTPUT
echo "uncompressed_size=$uncompressed_size" >> $GITHUB_OUTPUT
echo "compressed_size=$compressed_size" >> $GITHUB_OUTPUT
shell: bash
- name: Add summary info
continue-on-error: true
run: |
echo "### Build Summary for ${{ matrix.artifact_name }}" >> $GITHUB_STEP_SUMMARY
echo "- Uncompressed size: ${{ steps.archive.outputs.uncompressed_size }}" >> $GITHUB_STEP_SUMMARY
echo "- Compressed artifact size: ${{ steps.archive.outputs.compressed_size }}" >> $GITHUB_STEP_SUMMARY
echo "- Executable build time: ${{ steps.build_exe.outputs.build_time }} seconds" >> $GITHUB_STEP_SUMMARY
shell: bash # Holy shit i fucking hate windows
- name: generate release notes
id: release_notes
run: |
echo "# Release ${{ github.ref_name }}" > RELEASE_NOTES.md
echo >> RELEASE_NOTES.md
echo '## Changes since last release:' >> RELEASE_NOTES.md
git log --pretty=format:'- %s (%an)' $(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))..HEAD >> RELEASE_NOTES.md
shell: bash # Holy shit i fucking hate windows
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ steps.archive.outputs.archive_name }}
- name: upload release asset
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.archive.outputs.archive_name }}
body_path: RELEASE_NOTES.md