Skip to content

Commit

Permalink
minor updates of Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesneimog committed Jul 20, 2024
1 parent 10721cb commit 5d7fb84
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 170 deletions.
170 changes: 21 additions & 149 deletions .github/workflows/pd4web-tests.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,17 @@
name: pd4web Tests
name: Python Wheels
on:
release:
types: [published]
workflow_dispatch:
push:
branches: ["main", "v2.0.0"]
pull_request:
branches: ["main", "v2.0.0"]
jobs:
# ==============================================================================
# = WINDOWS =
# ==============================================================================
windows-build:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install pd4web
run: |
pip install poetry selenium
poetry build && poetry install
$wheels = Get-ChildItem -Path dist\*.whl
pip install $wheels
- name: Tests
run: |
cd pd4web/tests/
python ./runTests.py
- name: Upload Compiled website
uses: actions/upload-artifact@v3
with:
name: compiledWebsite-Win
path: pd4web/tests/
# =======================
# = BROWSER TEST =
# =======================
browser-tests-for-Windows:
needs: [windows-build]
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Download Win Compiled
uses: actions/download-artifact@v3
with:
name: compiledWebsite-Win
path: pd4web/tests/
- name: Test Compiled Code
run: |
cd pd4web/tests/
pip install selenium
python3 ./runBrowserTest.py
# ==============================================================================
# = MAC INTEL =
# ==============================================================================
macos-intel-build:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -77,97 +22,24 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install google
run: |
sudo apt update
sudo apt install -y wget
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb
sudo apt-get install chromium-chromedriver
- name: Install pd4web
run: |
pip install poetry certifi selenium
CERT_PATH=$(python -m certifi)
export SSL_CERT_FILE=${CERT_PATH}
export REQUESTS_CA_BUNDLE=${CERT_PATH}
pip install poetry selenium flask
poetry build
pip install dist/*.whl
- name: Tests
run: |
cd pd4web/tests/
python3 ./runTests.py
- name: Upload Compiled website
uses: actions/upload-artifact@v3
with:
name: compiledWebsite-Mac
path: pd4web/tests/
# =======================
# = BROWSER TEST =
# =======================
browser-tests-for-MAC:
needs: [macos-intel-build] # List all previous jobs here
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Download Mac Compiled
uses: actions/download-artifact@v3
with:
name: compiledWebsite-Mac
path: pd4web/tests/
- name: list files
run: |
cd pd4web/tests/1_SimplePatch && ls -a -l
- name: Test Compiled Code
run: |
cd pd4web/tests/
pip install selenium
python3 ./runBrowserTest.py
# ==============================================================================
# = LINUX =
# ==============================================================================
linux-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install pd4web
run: "pip install poetry selenium\npoetry build \npip install dist/*.whl\n"
- name: Test pd4web
run: |
pd4web --help
- name: Tests
run: |
cd pd4web/tests/
python3 ./runTests.py
# ==============================================================================
# = UPLOAD TO PACKAGE =
# ==============================================================================
upload-to-pip:
if: github.event_name == 'release'
needs: [browser-tests-for-MAC, browser-tests-for-Windows, linux-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build package
run: poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
python3 ./Tests/Tests.py
- name: Upload Wheels
if: matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
name: pd4web-2.0.0-py3-none-any.whl
path: dist/pd4web-2.0.0-py3-none-any.whl
36 changes: 36 additions & 0 deletions .github/workflows/pd4web-wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pd4web publish
on:
release:
types: [published]
workflow_dispatch:

jobs:
linux-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install pd4web
run: |
poetry build
pip install dist/*.whl
- if: github.event_name == 'release'
name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
76 changes: 76 additions & 0 deletions Documentation/assets/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Sources/favicon.ico
Binary file not shown.
42 changes: 21 additions & 21 deletions Sources/pd4web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,27 @@ void Pd4Web::Init() {

m_Context = AudioContext;

libpd_start_message(1);
libpd_add_float(1.0f);
libpd_finish_message("pd", "dsp");
libpd_init_audio(NInCh, NOutCh, SR);

if (!libpd_openfile("index.pd", "./")) {
Alert("Failed to open patch | Please Report!\n");
return;
}

m_PdInit = true;
ResumeAudio();
_Pd4WebJSFunctions();
return;
}
// ╭─────────────────────────────────────╮
// │ Main Function │
// ╰─────────────────────────────────────╯
int main() {
_Pd4WebEnableThreads();

libpd_set_printhook(ReceivePrint);
libpd_set_banghook(ReceiveBang);
libpd_set_floathook(ReceiveFloat);
Expand All @@ -372,29 +393,8 @@ void Pd4Web::Init() {

libpd_init();
Pd4WebInitExternals();

libpd_start_message(1);
libpd_add_float(1.0f);
libpd_finish_message("pd", "dsp");
libpd_init_audio(NInCh, NOutCh, SR);

if (!libpd_openfile("index.pd", "./")) {
Alert("Failed to open patch | Please Report!\n");
return;
}

m_PdInit = true;
ResumeAudio();
_Pd4WebJSFunctions();
if (PD4WEB_GUI) {
_Pd4WebInitGui();
}
return;
}
// ╭─────────────────────────────────────╮
// │ Main Function │
// ╰─────────────────────────────────────╯
int main() {
_Pd4WebEnableThreads();
return 0;
}
2 changes: 2 additions & 0 deletions Sources/pd4web/Builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ def AddFilesToWebPatch(self):
def CreateCppCallsExternalFile(self):
audioConfig = self.Pd4Web.PROJECT_ROOT + "/Pd4Web/config.h"
with open(audioConfig, "w") as f:
if self.Pd4Web.OUTCHS_COUNT == 0:
self.Pd4Web.OUTCHS_COUNT = 2
f.write(
"// This is automatically generated code from pd4web.py script\n\n")
# print the PD4WEB_CHS_IN
Expand Down
8 changes: 8 additions & 0 deletions Tests/Test6/Test6.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#N canvas 6 28 951 1012 8;
#X obj 58 100 print OK;
#X obj 59 22 loadbang;
#X obj 58 79 metro 500;
#X obj 122 27 bng 15 250 50 0 empty empty empty 0 -8 0 8 #fcfcfc #000000 #000000;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 3 0 2 0;
4 changes: 4 additions & 0 deletions Tests/Tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def testar():
element = driver.find_element(By.XPATH, '//*[@id="turnAudioOn"]')
element.click()
logs = driver.get_log("browser")
time.sleep(5)

for log_entry in logs:
message = "".join(log_entry["message"])
Expand Down Expand Up @@ -123,6 +124,9 @@ def test_5(self):
self.assertEqual(str(context.exception),
"Library not supported: notfound")

def test_6(self):
self.RunTest(6)


if __name__ == "__main__":
unittest.main()

0 comments on commit 5d7fb84

Please sign in to comment.