Skip to content

Commit

Permalink
[Misc] Migrate from Poetry to PDM, continue rework of build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
melianmiko committed Feb 7, 2025
1 parent 30ea6f8 commit a1c8749
Show file tree
Hide file tree
Showing 12 changed files with 635 additions and 824 deletions.
50 changes: 13 additions & 37 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,40 @@ name: Build & Test
on: push

jobs:
PyTest:
runs-on: ubuntu-24.04
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.8.3"
- uses: actions/checkout@v4
- name: Set up poetry environment
run: poetry install --without extras
- name: Run pytest
run: poetry run pytest

BuildExe:
runs-on: windows-latest
steps:
- name: Install Qt Lrelease
run: |
(New-Object System.Net.WebClient).DownloadFile("https://st.mmk.pw/lrelease.zip","lrelease.zip");
Expand-Archive .\lrelease.zip ..\lrelease;
echo "$((Get-Item ..).FullName)/lrelease" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/setup-python@v5
- uses: pdm-project/setup-pdm@v4
with:
python-version: '3.12'
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.8.3"
python-version: 3.13
cache: true
- name: Install Just
run: choco install just
- uses: actions/checkout@v4
- run: just prepare
- run: just bump_version_git build pkg_win32_portable
- run: just --evaluate
- run: just bump_version_git build win32_portable
- name: Upload portable
uses: actions/upload-artifact@v4
with:
name: openfreebuds_win32
path: .\dist\*
if-no-files-found: error

BuildDeb:
TestAndBuildDebian:
runs-on: ubuntu-24.04
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- uses: pdm-project/setup-pdm@v4
with:
poetry-version: "1.8.3"
python-version: 3.13
cache: true
- name: Install Just
run: curl -s https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin
- uses: actions/checkout@v4
- run: just dependencies_debian prepare
- run: just bump_version_git build pkg_debian
- run: just deps_debian prepare
- run: just --evaluate
- run: just test
- run: just bump_version_git build debian
- name: Upload bundle
uses: actions/upload-artifact@v4
with:
Expand Down
14 changes: 5 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
*.swp
*#

/test.py
/build
/builddir
/dist
/.idea
/.flatpak
/.flatpak-pip-generator
/.vagrant
/scripts/tools
/release.json
/accent.json
/.pdm-python
/dist

# Portable mode data
/data
/is_portable

/.idea
101 changes: 85 additions & 16 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Vagrant.configure("2") do |config|
debian.vm.box = "generic/debian12"
debian.vm.synced_folder ".", "/home/vagrant/openfreebuds"

debian.vm.provision "shell",
run: 'once',
name: "Prepare base dependencies (Flatpak, Just, Poetry)",
privileged: true,
debian.vm.provision "shell",
run: 'once',
name: "Prepare base dependencies (Flatpak, Just, Poetry)",
privileged: true,
inline: <<-SHELL
apt update
apt install -y --no-install-recommends pipx curl flatpak python-is-python3
apt install -y --no-install-recommends pipx curl flatpak python-is-python3 python3-venv
# Install qasync (not in Debian repos, required for packaging as runtime dep)
# Since Debian 13, will be in main repo
Expand All @@ -25,29 +25,98 @@ Vagrant.configure("2") do |config|
fi
# Install Poetry for user
sudo -u vagrant pipx install poetry
echo 'export PATH=$PATH:/home/vagrant/.local/bin' >> /home/vagrant/.bashrc
if [ ! -f /home/vagrant/.local/bin/pdm ]
then
curl -sSL https://pdm-project.org/install-pdm.py | sudo -u vagrant python3 -
fi
SHELL

debian.vm.provision "shell",
run: 'always',
debian.vm.provision "shell",
run: 'always',
name: "Install Flatpak requirements",
privileged: false,
privileged: false,
inline: <<-SHELL
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install -y --user org.flatpak.Builder
SHELL

debian.vm.provision "shell",
run: 'always',
name: "Install and build everything",
privileged: false,
debian.vm.provision "shell",
run: 'always',
name: "Install project dependencies",
privileged: false,
inline: <<-SHELL
cd ~/openfreebuds
just deps_debian prepare
SHELL

debian.vm.provision "shell",
run: 'always',
name: "Build binaries",
privileged: false,
inline: <<-SHELL
export FLATPAKBUILDDIR=$HOME/flatpak
cd ~/openfreebuds
just dependencies_debian prepare
just build pkg_debian_full pkg_flatpak
just --evaluate
just build debian flatpak
SHELL
end

config.vm.define "windows", primary: true do |win|
win.vm.box = "gusztavvargadr/windows-11-24h2-enterprise"
win.vm.synced_folder ".", "C:\\openfreebuds"
win.vm.provider "vmware_desktop" do |v|
v.gui = true
end

win.vm.provision "shell",
run: 'once',
name: "Prepare base dependencies (Just, Python, VSBuildTools, NSIS, UPX)",
privileged: true,
inline: <<-SHELL
powercfg.exe -x -standby-timeout-ac 0
powercfg.exe -x -standby-timeout-dc 0
powercfg.exe -x -hibernate-timeout-ac 0
powercfg.exe -x -hibernate-timeout-dc 0
if (-Not (Get-Command 'winget' -errorAction SilentlyContinue)) {
echo 'Sleep for 60s for winget appear...'; Start-Sleep -s 60
}
winget install -e --accept-source-agreements --no-upgrade --id Casey.Just
winget install -e --no-upgrade --id NSIS.NSIS
winget install -e --no-upgrade --id UPX.UPX
winget install -e --no-upgrade --id Python.Python.3.13
winget install -e --no-upgrade --id Microsoft.VisualStudio.2022.BuildTools --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended"
SHELL

win.vm.provision "shell",
run: 'once',
name: "Prepare PDM",
privileged: true,
inline: <<-SHELL
powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install-pdm.py | python -"
SHELL

win.vm.provision "shell",
run: 'once',
name: "Prepare project dependencies",
privileged: true,
inline: <<-SHELL
cd C:\\openfreebuds
just prepare
SHELL

win.vm.provision "shell",
run: 'once',
name: "Build project",
privileged: true,
inline: <<-SHELL
cd C:\\openfreebuds
just --evaluate
just build win32
SHELL
end
end
10 changes: 5 additions & 5 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Homepage: https://github.com/melianmiko/OpenFreebuds
Package: openfreebuds
Architecture: all
Depends:
${misc:Depends},
${misc:Depends},
python3 (>= 3.11),
python3-dbus-next,
python3-pyqt6,
python3-pil,
python3-qasync,
python3-dbus-next,
python3-pyqt6,
python3-pil,
python3-qasync,
python3-aiohttp,
python3-psutil
Description:
Expand Down
Loading

0 comments on commit a1c8749

Please sign in to comment.