Legacy support #23

Merged
Sudo-Ivan merged 7 commits from legacy-support into master 2025-12-06 05:34:20 +00:00
Showing only changes of commit 6efac94f58 - Show all commits

View File

@@ -80,6 +80,8 @@ jobs:
release_artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe"
build_input: build_windows
dist_script: dist-prebuilt
variant: standard
electron_version: "39.2.4"
- name: mac
os: macos-14
node: 18
@@ -87,6 +89,8 @@ jobs:
release_artifacts: "dist/*-mac-*.dmg"
build_input: build_mac
dist_script: dist:mac-universal
variant: standard
electron_version: "39.2.4"
- name: linux
os: ubuntu-latest
node: 22
@@ -94,6 +98,26 @@ jobs:
release_artifacts: "dist/*-linux.AppImage,dist/*-linux.deb,python-dist/*.whl"
build_input: build_linux
dist_script: dist-prebuilt
variant: standard
electron_version: "39.2.4"
- name: windows-legacy
os: windows-latest
node: 22
python: "3.12"
release_artifacts: "dist/*-win-installer*.exe,dist/*-win-portable*.exe"
build_input: build_windows
dist_script: dist-prebuilt
variant: legacy
electron_version: "30.0.8"
- name: linux-legacy
os: ubuntu-latest
node: 22
python: "3.12"
release_artifacts: "dist/*-linux*.AppImage,dist/*-linux*.deb,python-dist/*.whl"
build_input: build_linux
dist_script: dist-prebuilt
variant: legacy
electron_version: "30.0.8"
permissions:
contents: write
steps:
@@ -103,6 +127,16 @@ jobs:
(github.event_name == 'workflow_dispatch' && inputs[matrix.build_input] == true)
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
- name: Set legacy Electron version
if: |
matrix.variant == 'legacy' &&
(github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && inputs[matrix.build_input] == true))
shell: bash
run: |
node -e "const fs=require('fs');const pkg=require('./package.json');pkg.devDependencies.electron='${{ matrix.electron_version }}';fs.writeFileSync('package.json', JSON.stringify(pkg,null,2));"
if [ -f package-lock.json ]; then rm package-lock.json; fi
- name: Install NodeJS
if: |
github.event_name == 'push' ||
@@ -160,14 +194,14 @@ jobs:
- name: Install patchelf
if: |
matrix.name == 'linux' &&
startsWith(matrix.name, 'linux') &&
(github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && inputs[matrix.build_input] == true))
run: sudo apt-get update && sudo apt-get install -y patchelf
- name: Build Python wheel
if: |
matrix.name == 'linux' &&
startsWith(matrix.name, 'linux') &&
(github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && inputs[matrix.build_input] == true))
run: |
@@ -182,6 +216,23 @@ jobs:
(github.event_name == 'workflow_dispatch' && inputs[matrix.build_input] == true)
coderabbitai[bot] commented 2025-12-06 05:17:51 +00:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion | 🟠 Major

Artifact renaming logic duplicates Makefile implementation; extract to shared script for maintainability.

The "Rename artifacts for legacy build" step duplicates the renaming logic from the Makefile's build-appimage-legacy and build-exe-legacy targets. The workflow version:

  • Uses bash shopt -s nullglob for safe glob matching (good practice).
  • Renames all legacy artifacts with a -legacy suffix.

The Makefile version does the same but is called only if the Makefile targets are invoked directly (which the workflow does not do).

Recommendation: Extract the renaming logic into a shared shell script (e.g., scripts/rename_legacy_artifacts.sh) and invoke it from both the Makefile and the workflow:

# scripts/rename_legacy_artifacts.sh
#!/bin/bash
set -e
shopt -s nullglob
for f in dist/*-win-installer.exe dist/*-win-portable.exe dist/*-linux.AppImage dist/*-linux.deb; do
  [ -e "$f" ] || continue
  dir=$(dirname "$f")
  base=$(basename "$f")
  ext="${base##*.}"
  name="${base%.$ext}"
  mv "$f" "$dir/${name}-legacy.${ext}"
done

Then in the workflow (line 225–234):

run: bash scripts/rename_legacy_artifacts.sh

And in the Makefile (lines 54–58, 63–67):

	bash scripts/rename_legacy_artifacts.sh

This eliminates duplication and makes future updates easier.

🤖 Prompt for AI Agents
.github/workflows/build.yml lines 219-234: the workflow duplicates Makefile
artifact-renaming logic—extract that loop into a shared executable script (e.g.,
scripts/rename_legacy_artifacts.sh) containing the bash renaming logic, make it
executable, replace the inline run block in this workflow with a call to execute
that script, and update the corresponding Makefile targets to call the same
script instead of duplicating the loop so both the CI workflow and Makefile
reuse the single canonical implementation.

âś… Addressed in commits bf8c22c to d97676a

_🛠️ Refactor suggestion_ | _🟠 Major_ **Artifact renaming logic duplicates Makefile implementation; extract to shared script for maintainability.** The "Rename artifacts for legacy build" step duplicates the renaming logic from the Makefile's `build-appimage-legacy` and `build-exe-legacy` targets. The workflow version: - Uses bash `shopt -s nullglob` for safe glob matching (good practice). - Renames all legacy artifacts with a `-legacy` suffix. The Makefile version does the same but is called only if the Makefile targets are invoked directly (which the workflow does not do). **Recommendation:** Extract the renaming logic into a shared shell script (e.g., `scripts/rename_legacy_artifacts.sh`) and invoke it from both the Makefile and the workflow: ```bash # scripts/rename_legacy_artifacts.sh #!/bin/bash set -e shopt -s nullglob for f in dist/*-win-installer.exe dist/*-win-portable.exe dist/*-linux.AppImage dist/*-linux.deb; do [ -e "$f" ] || continue dir=$(dirname "$f") base=$(basename "$f") ext="${base##*.}" name="${base%.$ext}" mv "$f" "$dir/${name}-legacy.${ext}" done ``` Then in the workflow (line 225–234): ```yaml run: bash scripts/rename_legacy_artifacts.sh ``` And in the Makefile (lines 54–58, 63–67): ```makefile bash scripts/rename_legacy_artifacts.sh ``` This eliminates duplication and makes future updates easier. <details> <summary>🤖 Prompt for AI Agents</summary> ``` .github/workflows/build.yml lines 219-234: the workflow duplicates Makefile artifact-renaming logic—extract that loop into a shared executable script (e.g., scripts/rename_legacy_artifacts.sh) containing the bash renaming logic, make it executable, replace the inline run block in this workflow with a call to execute that script, and update the corresponding Makefile targets to call the same script instead of duplicating the loop so both the CI workflow and Makefile reuse the single canonical implementation. ``` </details> <!-- fingerprinting:phantom:triton:mongoose --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits bf8c22c to d97676a
run: npm run ${{ matrix.dist_script }}
- name: Rename artifacts for legacy build
if: |
matrix.variant == 'legacy' &&
(github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && inputs[matrix.build_input] == true))
shell: bash
run: |
shopt -s nullglob
for f in dist/*-win-installer.exe dist/*-win-portable.exe dist/*-linux.AppImage dist/*-linux.deb; do
[ -e "$f" ] || continue
dir=$(dirname "$f")
base=$(basename "$f")
ext="${base##*.}"
name="${base%.$ext}"
mv "$f" "$dir/${name}-legacy.${ext}"
done
- name: Upload build artifacts
if: |
github.event_name == 'push' ||
@@ -190,11 +241,11 @@ jobs:
with:
name: build-${{ matrix.name }}
path: |
dist/*-win-installer.exe
dist/*-win-portable.exe
dist/*-win-installer*.exe
dist/*-win-portable*.exe
dist/*-mac-*.dmg
dist/*-linux.AppImage
dist/*-linux.deb
dist/*-linux*.AppImage
dist/*-linux*.deb
python-dist/*.whl
if-no-files-found: ignore