From c4df923ccd33de2698ff0134c491dd8a50a6d01b Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 01:13:18 +0100 Subject: [PATCH 1/8] Consolidate build workflows into a single one --- .../{build_linux_elf.yml => build.yml} | 16 ++++++++++++++-- .github/workflows/build_windows_exe.yml | 19 ------------------- .github/workflows/checks.yml | 10 +++++++--- .github/workflows/tests.yml | 18 +++++++++++++----- 4 files changed, 34 insertions(+), 29 deletions(-) rename .github/workflows/{build_linux_elf.yml => build.yml} (52%) delete mode 100644 .github/workflows/build_windows_exe.yml diff --git a/.github/workflows/build_linux_elf.yml b/.github/workflows/build.yml similarity index 52% rename from .github/workflows/build_linux_elf.yml rename to .github/workflows/build.yml index 541a023..710c6ae 100644 --- a/.github/workflows/build_linux_elf.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Linux ELF +name: Build binaries on: push: @@ -6,7 +6,7 @@ on: - "*" jobs: - build: + linux-elf: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,3 +18,15 @@ jobs: with: name: PythonTurtle for Linux path: /home/runner/work/PythonTurtle/PythonTurtle/dist/PythonTurtle + + windows-exe: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: python -m pip install pyinstaller + - run: python setup.py clean bundle + - uses: actions/upload-artifact@v2 + with: + name: PythonTurtle for Windows + path: D:\a\PythonTurtle\PythonTurtle\dist\PythonTurtle.exe diff --git a/.github/workflows/build_windows_exe.yml b/.github/workflows/build_windows_exe.yml deleted file mode 100644 index 31e08b3..0000000 --- a/.github/workflows/build_windows_exe.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Build Windows exe - -on: - push: - tags: - - "*" - -jobs: - build: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - run: python -m pip install pyinstaller - - run: python setup.py clean bundle - - uses: actions/upload-artifact@v2 - with: - name: PythonTurtle for Windows - path: D:\a\PythonTurtle\PythonTurtle\dist\PythonTurtle.exe diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6ddebc0..4b207e7 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -2,9 +2,11 @@ name: Checks on: pull_request: - branches: [master] + branches: + - master push: - branches: [master] + branches: + - master jobs: build: @@ -12,7 +14,9 @@ jobs: strategy: fail-fast: false matrix: - env: [flake8, pylint] + env: + - flake8 + - pylint steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4200cf8..0601295 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,11 @@ name: Tests on: pull_request: - branches: [master] + branches: + - master push: - branches: [master] + branches: + - master jobs: build: @@ -12,16 +14,22 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8] + os: + - ubuntu-latest + - macos-latest + - windows-latest + python-version: + - '3.6' + - '3.7' + - '3.8' steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies for Ubuntu - run: sudo apt-get install libsdl2-2.0-0 if: matrix.os == 'ubuntu-latest' + run: sudo apt-get install libsdl2-2.0-0 - name: Install prerequisites run: python -m pip install --upgrade setuptools pip wheel tox-gh-actions - name: Run tests From 204a35497baa7594a84c0478202879642cbe880c Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 01:40:32 +0100 Subject: [PATCH 2/8] Install latest Pylint (has dependency issues fixed) --- setup.py | 2 +- tox.ini | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 1cf655d..5caddda 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def run(): """ Create an application bundle (using PyInstaller) """ - import PyInstaller.__main__ + import PyInstaller.__main__ # pylint: disable=import-outside-toplevel resources_folder = os.path.join('pythonturtle', 'resources') diff --git a/tox.ini b/tox.ini index 55cbb97..1679188 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # - Installing wxPython is non-trivial on GNU/Linux. We need to install wheels from a dedicated repository, # located at https://extras.wxpython.org/wxPython4/extras/linux/. For beackground reading see # https://wiki.wxpython.org/How%20to%20install%20wxPython#Installing_wxPython-Phoenix_using_pip -# - The wheel repository specified via --find-links below matches the build environment on Travis CI. +# - The wheel repository specified via --find-links below matches the build environment on GitHub Actions. # - For local Tox runs adapt the wheel repository URLs to match your local environment. [tox] @@ -25,7 +25,6 @@ commands = [testenv:flake8] description = Static code analysis and code style -basepython = python3.6 deps = flake8 commands = @@ -33,10 +32,8 @@ commands = [testenv:pylint] description = Check for errors and code smells -basepython = python3.6 deps = - astroid<2.2 - pylint<2.4 + pylint pyinstaller commands = {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython From 95ff616bb603c2dc064d55943bbf7bf5e9d17b38 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 02:13:38 +0100 Subject: [PATCH 3/8] Build macOS app This change bases on engineering efforts in PR #155 --- .github/workflows/build.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 710c6ae..4a28ada 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: Build binaries on: + pull_request: + branches: + - master push: tags: - "*" @@ -17,7 +20,19 @@ jobs: - uses: actions/upload-artifact@v2 with: name: PythonTurtle for Linux - path: /home/runner/work/PythonTurtle/PythonTurtle/dist/PythonTurtle + path: ${{ github.workspace }}/dist/PythonTurtle + + macos-app: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: python -m pip install pyinstaller + - run: python setup.py clean bundle + - uses: actions/upload-artifact@v2 + with: + name: PythonTurtle for macOS + path: ${{ github.workspace }}/dist/PythonTurtle.app windows-exe: runs-on: windows-latest @@ -29,4 +44,4 @@ jobs: - uses: actions/upload-artifact@v2 with: name: PythonTurtle for Windows - path: D:\a\PythonTurtle\PythonTurtle\dist\PythonTurtle.exe + path: ${{ github.workspace }}\dist\PythonTurtle.exe From c35feb7bb44fbe19fd8f58eba98e7c27d33fff82 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 02:36:55 +0100 Subject: [PATCH 4/8] Fix "Unknown Mach-O header" error in macOS builds See https://github.com/NordicSemiconductor/pc-nrfutil/issues/183#issuecomment-670400846 and https://github.com/pyinstaller/pyinstaller/issues/4126 --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 5caddda..9955f00 100755 --- a/setup.py +++ b/setup.py @@ -50,8 +50,8 @@ def include_resources(file_glob): '--name=%s' % package.name, '--onefile', '--windowed', - '--add-binary=%s' % include_resources('*.ic*'), - '--add-binary=%s' % include_resources('*.png'), + '--add-data=%s' % include_resources('*.ic*'), + '--add-data=%s' % include_resources('*.png'), '--add-data=%s' % include_resources('*.txt'), '--icon=%s' % resource_path('icon.ico'), os.path.join('pythonturtle', '__main__.py'), From 9bb375607209cfb816c0bf3551bd9202f7368b1d Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 02:57:19 +0100 Subject: [PATCH 5/8] Use short names for artifacts to upload --- .github/workflows/build.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a28ada..025ae35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - run: python setup.py clean bundle - uses: actions/upload-artifact@v2 with: - name: PythonTurtle for Linux + name: PythonTurtle path: ${{ github.workspace }}/dist/PythonTurtle macos-app: @@ -29,10 +29,11 @@ jobs: - uses: actions/setup-python@v2 - run: python -m pip install pyinstaller - run: python setup.py clean bundle + - run: rm ${{ github.workspace }}/dist/PythonTurtle - uses: actions/upload-artifact@v2 with: - name: PythonTurtle for macOS - path: ${{ github.workspace }}/dist/PythonTurtle.app + name: PythonTurtle.app + path: ${{ github.workspace }}/dist/ windows-exe: runs-on: windows-latest @@ -43,5 +44,5 @@ jobs: - run: python setup.py clean bundle - uses: actions/upload-artifact@v2 with: - name: PythonTurtle for Windows + name: PythonTurtle.exe path: ${{ github.workspace }}\dist\PythonTurtle.exe From 8870576692a52c901400bd4870515445dfdaa3b0 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 03:04:24 +0100 Subject: [PATCH 6/8] Chain pipeline workflows --- .github/workflows/build.yml | 11 +++++------ .github/workflows/tests.yml | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 025ae35..8b0d17e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,11 @@ name: Build binaries on: - pull_request: - branches: - - master - push: - tags: - - "*" + workflow_run: + workflows: + - Tests + types: + - completed jobs: linux-elf: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0601295..feb821e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,12 +1,11 @@ name: Tests on: - pull_request: - branches: - - master - push: - branches: - - master + workflow_run: + workflows: + - Checks + types: + - completed jobs: build: From edb297dbaed5ae2be44b25eb036d26d87de1039e Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 03:22:04 +0100 Subject: [PATCH 7/8] Restore parallel execution of all jobs Workflow chaining doesn't work as expected --- .github/workflows/build.yml | 11 ++++++----- .github/workflows/tests.yml | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b0d17e..025ae35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,12 @@ name: Build binaries on: - workflow_run: - workflows: - - Tests - types: - - completed + pull_request: + branches: + - master + push: + tags: + - "*" jobs: linux-elf: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index feb821e..0601295 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,11 +1,12 @@ name: Tests on: - workflow_run: - workflows: - - Checks - types: - - completed + pull_request: + branches: + - master + push: + branches: + - master jobs: build: From 55976fcae5c79caf79c18424eaa9245cdae0f27a Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 03:37:27 +0100 Subject: [PATCH 8/8] Install wxPython to make built binaries work --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 025ae35..9f370e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,9 @@ jobs: - uses: actions/setup-python@v2 - run: sudo apt-get install libsdl2-2.0-0 - run: python -m pip install pyinstaller + - run: python -m pip install --find-links ${WHEELS} wxPython + env: + WHEELS: https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 - run: python setup.py clean bundle - uses: actions/upload-artifact@v2 with: @@ -27,7 +30,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - run: python -m pip install pyinstaller + - run: python -m pip install pyinstaller wxPython - run: python setup.py clean bundle - run: rm ${{ github.workspace }}/dist/PythonTurtle - uses: actions/upload-artifact@v2 @@ -40,7 +43,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - run: python -m pip install pyinstaller + - run: python -m pip install pyinstaller wxPython - run: python setup.py clean bundle - uses: actions/upload-artifact@v2 with: