Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Release

on:
workflow_dispatch:
inputs:
tag:
description: Git tag for the release (e.g. v1.0.0-rc1)
required: true
type: string
prerelease:
description: Mark the GitHub release as a prerelease
type: boolean
default: true

permissions:
contents: write

jobs:
test:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install dependencies
run: uv sync --group dev

- name: Ruff
run: uv run ruff check .

build:
name: Build (${{ matrix.id }})
needs: test
strategy:
fail-fast: false
matrix:
include:
# Add new rows here when supporting additional targets.
- id: win64
runner: windows-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install dependencies
run: uv sync --group build

- name: Build executable
run: uv run python build.py

- name: Stage release binary
shell: bash
run: cp dist/Firmware-Util.exe "Firmware-Util-${{ matrix.id }}.exe"

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.id }}
path: Firmware-Util-${{ matrix.id }}.exe
if-no-files-found: error

deliver:
name: Publish release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag }}
prerelease: ${{ github.event.inputs.prerelease == 'true' }}
generate_release_notes: true
files: release-assets/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def build_executable():
sys.exit(1)

if __name__ == "__main__":
if sys.platform != "win32":
if sys.platform != "win32" and not os.environ.get("CI"):
print("Warning: This should ideally be built on Windows for best compatibility.")
print("Building on non-Windows platform may have issues.")
input("Press Enter to continue anyway, or Ctrl+C to cancel...")
Expand Down
7 changes: 4 additions & 3 deletions firmware_flasher.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ def __init__(self, root):
try:
if os.path.exists('icon.png'):
self.root.iconphoto(True, tk.PhotoImage(file='icon.png'))
except:
pass
except Exception as e:
# Icon loading is optional; continue startup if it fails.
print(f"Warning: failed to set application icon: {e}", file=sys.stderr)

self.maroon = "#8B0000"
self.white = "#FFFFFF"
Expand Down Expand Up @@ -862,7 +863,7 @@ def _flash_firmware_thread(self, bin_asset):

def main():
root = tk.Tk()
app = FirmwareFlasher(root)
FirmwareFlasher(root)
root.mainloop()

if __name__ == "__main__":
Expand Down
23 changes: 19 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
[project]
name = "repl-nix-workspace"
version = "0.1.0"
description = "Add your description here"
name = "Firmware-Util"
version = "1.0.0"
description = "SDR's Firmware Flashing & Setup Utility"
requires-python = ">=3.11"
dependencies = [
"certifi>=2024.0.0",
"py7zr>=1.0.0",
"pyinstaller>=6.16.0",
"requests>=2.33.0",
]

[dependency-groups]
build = [
"pyinstaller>=6.16.0",
]
dev = [
"ruff>=0.11.0",
]

[tool.ruff]
target-version = "py311"
line-length = 120

[tool.ruff.lint.per-file-ignores]
"run_test.py" = ["F401"]
71 changes: 54 additions & 17 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading