Skip to content

Commit

Permalink
Merge pull request #57 from UniversityRadioYork/ash-linux-updates
Browse files Browse the repository at this point in the history
chore: updates to build on latest python/linux
  • Loading branch information
ashhhleyyy authored Apr 3, 2024
2 parents 6d7c3aa + 046fd3e commit 00c3cf9
Show file tree
Hide file tree
Showing 18 changed files with 4,947 additions and 125 deletions.
88 changes: 46 additions & 42 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@ name: Package
on: [push]

jobs:
build-macos:
# build-macos:

runs-on: macos-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
node-version: ['14']
# runs-on: macos-latest
# timeout-minutes: 15
# strategy:
# fail-fast: false
# matrix:
# python-version: ['3.9', '3.11']
# node-version: ['20']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Build .app
run: |
npm run presenter-make
build/build-macos.sh
zip -r build/output/BAPSicle.zip build/output/BAPSicle.app
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
- name: Archive Build
uses: actions/upload-artifact@v2
with:
name: BAPSicle-${{ steps.extract_branch.outputs.branch }}-${{github.sha}}-MacOS
path: |
build/output/BAPSicle.zip
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# - uses: actions/checkout@v2
# - name: Set up Node ${{ matrix.node-version }}
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.node-version }}
# - name: Build .app
# run: |
# npm run presenter-make
# build/build-macos.sh
# zip -r build/output/BAPSicle.zip build/output/BAPSicle.app
# - name: Extract branch name
# shell: bash
# run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
# id: extract_branch
# - name: Archive Build
# uses: actions/upload-artifact@v2
# with:
# name: BAPSicle-${{ steps.extract_branch.outputs.branch }}-${{github.sha}}-MacOS
# path: |
# build/output/BAPSicle.zip

build-ubuntu:

Expand All @@ -46,15 +46,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8','3.9']
node-version: ['14']
python-version: ['3.8','3.9', '3.11']
node-version: ['20']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup poetry
uses: Gr1N/setup-poetry@v8
- uses: actions/checkout@v2
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v2
Expand All @@ -69,9 +71,9 @@ jobs:
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
- name: Archive Build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: BAPSicle-${{ steps.extract_branch.outputs.branch }}-${{github.sha}}-Ubuntu
name: BAPSicle-${{ steps.extract_branch.outputs.branch }}-${{github.sha}}-Ubuntu-python${{matrix.python-version}}-node${{matrix.node-version}}
path: |
build/output/BAPSicle
Expand All @@ -82,15 +84,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
node-version: ['14']
python-version: ['3.9', '3.11']
node-version: ['20']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup poetry
uses: Gr1N/setup-poetry@v8
- uses: actions/checkout@v2
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v2
Expand All @@ -105,9 +109,9 @@ jobs:
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
- name: Archive Build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: BAPSicle-${{ steps.extract_branch.outputs.branch }}-${{github.sha}}-Windows
name: BAPSicle-${{ steps.extract_branch.outputs.branch }}-${{github.sha}}-Windows-python${{matrix.python-version}}-node${{matrix.node-version}}
path: |
build/output/BAPSicle.exe
install/
23 changes: 9 additions & 14 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,33 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.8, 3.9, 3.11]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup poetry
uses: Gr1N/setup-poetry@v8
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r build/requirements-dev.txt
pip install -r build/requirements.txt
pip install -r build/requirements-macos.txt
- name: Install bapsicle as module
run: |
pip install -e .
run: poetry install --with=dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --ignore=E402,E226,E24,W50,W690 --max-complexity=25 --max-line-length=127 --statistics
poetry run flake8 . --count --ignore=E402,E226,E24,W50,W690 --max-complexity=25 --max-line-length=127 --statistics
- name: Test with unittest
if: ${{ always() }}
timeout-minutes: 10
run: |
python -m sounddevice
python -m unittest
poetry run python -m sounddevice
poetry run python -m unittest
- name: Archive test logs
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Logs - Python ${{ matrix.python-version }}
path: |
Expand Down
4 changes: 2 additions & 2 deletions build/build-exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
file.close()

if isLinux():
cmd_str = "python3 -m PyInstaller "
cmd_str = "poetry run python3 -m PyInstaller "
else:
cmd_str = "pyinstaller "
cmd_str = "poetry run pyinstaller "

json_dests = ["icon_file", "clean_build"]
pyi_dests = ["icon", "clean"]
Expand Down
12 changes: 3 additions & 9 deletions build/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ echo "BRANCH: str = \"$build_branch\"" >> ../build.py
sudo apt install libportaudio2
sudo apt install python3-pip python3-venv ffmpeg

python3 -m venv ../venv
source ../venv/bin/activate
poetry install

pip3 install wheel
pip3 install -r requirements.txt
pip3 install -r requirements-linux.txt
pip3 install -e ../

python3 ./generate-build-exe-config.py
poetry run python3 ./generate-build-exe-config.py

chmod +x output/BAPSicle

python3 ./build-exe.py
poetry run python3 ./build-exe.py

bash ./build-exe-pyinstaller-command.sh

Expand Down
14 changes: 4 additions & 10 deletions build/build-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,18 @@ build_branch="$(git branch --show-current)"
echo "BUILD: str = \"$build_commit\"" > ../build.py
echo "BRANCH: str = \"$build_branch\"" >> ../build.py

python3 -m venv ../venv
source ../venv/bin/activate
poetry install

pip3 install wheel
pip3 install -r requirements.txt
pip3 install -r requirements-macos.txt
pip3 install -e ..\
poetry run python3 ./generate-build-exe-config.py

python3 ./generate-build-exe-config.py

python3 ./build-exe.py
poetry run python3 ./build-exe.py

bash ./build-exe-pyinstaller-command.sh

rm ./*.spec

cd ../
python3 build/generate-platypus-config.py
poetry run python3 build/generate-platypus-config.py
cd build

brew install platypus
Expand Down
16 changes: 3 additions & 13 deletions build/build-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,14 @@ SET build_branch=%%F
echo BUILD: str = "%build_commit%"> ..\build.py
echo BRANCH: str = "%build_branch%">> ..\build.py

if "%1" == "no-venv" goto skip-venv

py -m venv ..\venv
..\venv\Scripts\activate

:skip-venv

pip install wheel
pip install -r requirements.txt
pip install -r requirements-windows.txt
pip install -e ..\
poetry install

: Generate the json config in case you wanted to use the gui to regenerate the command below manually.
python generate-build-exe-config.py
poetry run python generate-build-exe-config.py

: auto-py-to-exe -c build-exe-config.json -o ../install

python build-exe.py
poetry run python build-exe.py

build-exe-pyinstaller-command.bat

Expand Down
4 changes: 0 additions & 4 deletions build/requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/requirements-linux.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/requirements-macos.txt

This file was deleted.

2 changes: 0 additions & 2 deletions build/requirements-windows.txt

This file was deleted.

17 changes: 0 additions & 17 deletions build/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion dev/install-githook.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
pip3 install autopep8
poetry install
cd "$(dirname "$0")"
cp "./pre-commit" "../.git/hooks/"

3 changes: 1 addition & 2 deletions helpers/device_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def getAudioOutputs(cls) -> Tuple[List[Dict]]:
def getAudioDevices(cls) -> List[str]:
mixer.init(44100, -16, 2, 1024)
is_capture = 0 # zero to request playback devices, non-zero to request recording devices
num = sdl2.get_num_audio_devices(is_capture)
names = [str(sdl2.get_audio_device_name(i, is_capture), encoding="utf-8") for i in range(num)]
names = sdl2.audio.get_audio_device_names(is_capture)
mixer.quit()
return names

Expand Down
24 changes: 20 additions & 4 deletions package-lock.json

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

Loading

0 comments on commit 00c3cf9

Please sign in to comment.