fix(pyproject.toml): add D106 to ignore list #101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build LDDC | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
paths: | |
- "**.py" | |
- ".github/workflows/build.yml" | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-13, ubuntu-latest, windows-latest] | |
arch: [x64] | |
include: | |
- os: macos-latest | |
arch: arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
architecture: ${{ matrix.arch }} | |
- name: Get arch | |
id: arch | |
shell: bash | |
run: | | |
if [[ ${{ matrix.arch }} == 'x64' ]]; then | |
echo "arch=amd64" >> $GITHUB_OUTPUT | |
echo "nuitka_arch=x86_64" >> $GITHUB_OUTPUT | |
elif [[ ${{ matrix.arch }} == 'arm64' ]]; then | |
echo "arch=arm64" >> $GITHUB_OUTPUT | |
echo "nuitka_arch=arm64" >> $GITHUB_OUTPUT | |
elif [[ ${{ matrix.arch }} == 'win32' ]]; then | |
echo "arch=x86" >> $GITHUB_OUTPUT | |
echo "nuitka_arch=universal" >> $GITHUB_OUTPUT | |
fi | |
- name: Install dependencies(Linux/macOS) | |
if : ${{ runner.os == 'Linux' || runner.os == 'macOS'}} | |
run: | | |
pip install PySide6-Addons | |
qt_translations_path=$(python build_helper.py --task get_qt_translations_path) | |
mkdir -p /tmp/qt_translations | |
cp $qt_translations_path/*.qm /tmp/qt_translations | |
pip freeze > /tmp/modules.txt | |
pip uninstall -r /tmp/modules.txt -y | |
pip install -Ur requirements.txt | |
pip install imageio | |
cp -f /tmp/qt_translations/*.qm $qt_translations_path/ | |
ls -alh $qt_translations_path/ | |
- name: Install dependencies(Windows) | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
pip install PySide6-Addons | |
$qt_translations_path = python build_helper.py --task get_qt_translations_path | |
$temp_path = $env:TEMP + "\qt_translations" | |
if (!(Test-Path -Path $temp_path)) { | |
New-Item -ItemType Directory -Path $temp_path | |
} | |
Copy-Item "$qt_translations_path/*.qm" -Destination $temp_path | |
pip freeze | Out-File "$env:TEMP\modules.txt" | |
pip uninstall -r "$env:TEMP\modules.txt" -y | |
pip install -Ur requirements.txt | |
pip install imageio | |
Copy-Item -Force "$temp_path\*.qm" -Destination "$qt_translations_path/" | |
Get-ChildItem -Path "$qt_translations_path/" | |
- name: Install EGL/upx | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install libegl1 upx | |
- name: Install create-dmg | |
if: ${{ runner.os == 'macOS' }} | |
run: | | |
brew install create-dmg | |
- name: Install upx/7zip | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
choco install upx 7zip -y | |
# Remove problematic brew libs if Intel Mac https://github.com/Nuitka/Nuitka/issues/2853#issuecomment-2119520735 | |
- name: Remove problematic brew libs | |
run: | | |
brew remove --force --ignore-dependencies openssl@3 | |
brew cleanup openssl@3 | |
if: runner.os == 'macOS' && runner.arch == 'X64' | |
- name: mkdir | |
run: | | |
mkdir -p dist | |
mkdir -p upload | |
- name: Get Information | |
id: info | |
shell: bash | |
run: | | |
echo "copyright=Copyright (C) $(python build_helper.py --task get_year) 沉默の金" >> $GITHUB_OUTPUT | |
echo "version=$(python build_helper.py --task get_version)" >> $GITHUB_OUTPUT | |
echo "num_version=$(python build_helper.py --task get_num_version)" >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
- name: Build Executable(Linux/macOS) | |
uses: Nuitka/Nuitka-Action@main | |
if : ${{ runner.os == 'Linux' || runner.os == 'macOS'}} | |
with: | |
nuitka-version: main | |
script-name: LDDC | |
standalone: true | |
onefile: false | |
report: nuitka-report.xml | |
enable-plugins: pyside6 | |
product-name: "LDDC" | |
file-version: ${{ steps.info.outputs.num_version }} | |
product-version: ${{ steps.info.outputs.num_version }} | |
copyright: ${{ steps.info.outputs.copyright }} | |
disable-console: true | |
macos-app-icon: "LDDC/res/img/icon/logo.icns" | |
macos-app-version: ${{ steps.info.outputs.num_version }} | |
macos-create-app-bundle: true | |
macos-target-arch: ${{ steps.arch.outputs.nuitka_arch }} | |
env: | |
PYTHONPATH: ${{ github.workspace }} | |
- name: Build Executable(Windows) | |
uses: Nuitka/Nuitka-Action@main | |
if : ${{ runner.os == 'Windows' }} | |
with: | |
nuitka-version: main | |
script-name: LDDC | |
standalone: true | |
onefile: false | |
report: nuitka-report.xml | |
enable-plugins: pyside6 | |
product-name: "LDDC" | |
file-version: ${{ steps.info.outputs.num_version }} | |
product-version: ${{ steps.info.outputs.num_version }} | |
copyright: ${{ steps.info.outputs.copyright }} | |
windows-icon-from-ico: "LDDC/res/img/icon/logo.ico" | |
mingw64: true | |
windows-console-mode: 'attach' | |
env: | |
PYTHONPATH: ${{ github.workspace }} | |
- name: Upload report | |
uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: ${{ runner.os }} - ${{ matrix.arch }} report | |
path: | | |
nuitka-crash-report.xml | |
nuitka-report.xml | |
- name: create dmg | |
if: ${{ runner.os == 'macOS' }} | |
run: | | |
create-dmg \ | |
--volname "LDDC" \ | |
--volicon "LDDC/res/img/icon/logo.icns" \ | |
--window-pos 200 120 \ | |
--window-size 800 400 \ | |
--icon-size 100 \ | |
--icon "LDDC.app" 200 190 \ | |
--app-drop-link 600 185 \ | |
dist/LDDC.dmg \ | |
build/LDDC.app | |
mv dist/LDDC.dmg upload/LDDC-${{ steps.info.outputs.version }}-${{ steps.arch.outputs.arch }}.dmg | |
- name: Add fcitx5 support | |
if: ${{ runner.os == 'Linux' }} | |
uses: chenmozhijin/fcitx5-pyside@main | |
with: | |
plugins-path: ${{ github.workspace }}/build/LDDC.dist/PySide6/qt-plugins | |
- name: create deb package | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
cd dist | |
mkdir -p deb/DEBIAN | |
mkdir -p deb/usr/lib | |
mkdir -p deb/usr/bin | |
mkdir -p deb/usr/share/applications | |
mkdir -p deb/usr/share/icons/ | |
cp -r ../LDDC/res/img/icon/logo.ico deb/usr/share/icons/LDDC.ico | |
cp -RT ../build/LDDC.dist deb/usr/lib/LDDC | |
chmod +x deb/usr/lib/LDDC/LDDC.bin | |
ln -s ../lib/LDDC/LDDC.bin deb/usr/bin/LDDC | |
echo "Package: LDDC" >> deb/DEBIAN/control | |
echo "Version: ${{ steps.info.outputs.version }}" >> deb/DEBIAN/control | |
echo "Architecture: ${{ steps.arch.outputs.arch }}" >> deb/DEBIAN/control | |
echo "Maintainer: chenmozhijin <[email protected]>" >> deb/DEBIAN/control | |
echo "Description: Lyrics acquisition tool" >> deb/DEBIAN/control | |
echo "Homepage: https://github.com/chenmozhijin/LDDC" >> deb/DEBIAN/control | |
echo "[Desktop Entry]" >> deb/usr/share/applications/LDDC.desktop | |
echo "Name=LDDC" >> deb/usr/share/applications/LDDC.desktop | |
echo "Comment=Lyrics acquisition tool" >> deb/usr/share/applications/LDDC.desktop | |
echo "Exec=/usr/bin/LDDC" >> deb/usr/share/applications/LDDC.desktop | |
echo "Icon=/usr/share/icons/LDDC.ico" >> deb/usr/share/applications/LDDC.desktop | |
echo "Terminal=false" >> deb/usr/share/applications/LDDC.desktop | |
echo "Type=Application" >> deb/usr/share/applications/LDDC.desktop | |
echo "X-Ubuntu-Touch=true" >> deb/usr/share/applications/LDDC.desktop | |
echo "Categories=Application" >> deb/usr/share/applications/LDDC.desktop | |
chmod +x deb/usr/share/applications/LDDC.desktop | |
sudo dpkg -b deb LDDC_${{ steps.info.outputs.version }}_${{ steps.arch.outputs.arch }}.deb | |
sudo apt install ./LDDC_${{ steps.info.outputs.version }}_${{ steps.arch.outputs.arch }}.deb | |
cd .. | |
mv dist/LDDC_${{ steps.info.outputs.version }}_${{ steps.arch.outputs.arch }}.deb upload/LDDC_${{ steps.info.outputs.version }}_${{ steps.arch.outputs.arch }}.deb | |
- name: prepare create exe | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
New-Item -ItemType Directory -Force -Path dist/exe/main/ | |
New-Item -ItemType Directory -Force -Path dist/exe/main/other/ | |
Copy-Item -Path build/LDDC.dist/LDDC.exe -Destination dist/exe/main/LDDC.exe -Force | |
Copy-Item -Path build/LDDC.dist/ -Destination dist/exe/other/ -Recurse -Force | |
Remove-Item -Path dist/exe/other/LDDC.exe -Force | |
- name: Generate evb | |
if: ${{ runner.os == 'Windows' }} | |
uses: chenmozhijin/generate-evb@master | |
with: | |
inputExe: "dist/exe/main/LDDC.exe" | |
outputExe: "dist/exe/output/LDDC/LDDC.exe" | |
path2Pack: "dist/exe/other/" | |
evbFilePath: "dist/exe/LDDC.evb" | |
deleteExtractedOnExit: false | |
compressFiles: false | |
- name: create exe | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
New-Item -Path "dist\exe\chen" -ItemType Directory -Force | |
New-Item -Path "dist\exe\tools" -ItemType Directory -Force | |
cd dist/exe/chen | |
$latest_release = Invoke-RestMethod -Uri "https://api.github.com/repos/dscharrer/innoextract/releases/latest" | |
$download_url = ($latest_release.assets | Where-Object { $_.browser_download_url -like "*windows.zip" }).browser_download_url | |
Invoke-WebRequest -Uri $download_url -OutFile "innoextract_windows.zip" | |
Expand-Archive -Path "innoextract_windows.zip" -DestinationPath "../tools" -Force | |
$enigmavb_url = "http://enigmaprotector.com/assets/files/enigmavb.exe" | |
Invoke-WebRequest -Uri $enigmavb_url -OutFile "../tools/enigmavb.exe" | |
cd ../tools | |
.\innoextract.exe enigmavb.exe | |
cd ../../.. | |
dist/exe/tools/app/enigmavbconsole.exe dist/exe/LDDC.evb | |
- name: Upload dist | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ runner.os }} - ${{ matrix.arch }} Build | |
path: | | |
dist/ | |
build/ | |
- name: Compress exe | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
cd dist/exe/output/ | |
7z a -tzip -mx=9 ../../../upload/LDDC-${{ steps.info.outputs.version }}-windows-${{ steps.arch.outputs.arch }}-onefile.zip LDDC | |
cd ../../.. | |
Rename-Item -Path "build/LDDC.dist" -NewName "LDDC" | |
cd build | |
7z a -tzip -mx=9 ../upload/LDDC-${{ steps.info.outputs.version }}-windows-${{ steps.arch.outputs.arch }}.zip LDDC | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ runner.os }} - ${{ matrix.arch }} artifacts | |
path: | | |
upload/ | |
build-wheel: | |
name: Build wheel | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
pip install -Ur requirements-dev.txt | |
- name: Build wheel | |
run: | | |
python -m build | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Wheel | |
path: | | |
dist/ |