From 708cac518be5b6a555754711b3529ec8a4728032 Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 22:45:15 +0000 Subject: [PATCH 01/12] im going to try CI --- .github/workflows/python-app.yml | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..37b18a0 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,51 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - 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 + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest + - name: PyInstaller Linux + # You may pin to the exact commit or the version. + # uses: JackMcKew/pyinstaller-action-linux@38639c352a36917eea765f9283bfd1092c28af7b + uses: JackMcKew/pyinstaller-action-linux@0.1.4 + with: + # Directory containing source code & .spec file (optional requirements.txt). + path: '' + # Specify a custom URL for PYPI + pypi_url: https://pypi.python.org/ + # Specify a custom URL for PYPI Index + pypi_index_url: https://pypi.python.org/simple + # Specify a file path for .spec file + spec: '' + # Specify whether to install Tkinter or not + tkinter: false From ceaaf9e15661f4136a763b64fdb630b20f4a036b Mon Sep 17 00:00:00 2001 From: Conor Walker <2089327w@student.gla.ac.uk> Date: Tue, 25 Jan 2022 22:46:03 +0000 Subject: [PATCH 02/12] better output --- main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 823cad3..5c282ed 100644 --- a/main.py +++ b/main.py @@ -67,8 +67,9 @@ while counter < 6: if checkRight(wordToGuess, emptyWordGuess): print("Congratulations! The word was", ''.join(wordToGuess).capitalize()) exit(420) - print("Incorrect letters: " + str(wrongLetters)) - print("Correct letters in the wrong place: " + str(rightLettersWrongPlace)) + print("Incorrect letters: " + ', '.join(wrongLetters)) + + print("Correct letters in the wrong place: " + ', '.join(rightLettersWrongPlace)) print("Result: " + " ".join(emptyWordGuess)) counter += 1 From 4f386fa560d67edf34f62f547e9d5f61dd014a75 Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 22:49:05 +0000 Subject: [PATCH 03/12] Update python-app.yml --- .github/workflows/python-app.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 37b18a0..f508f66 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -20,20 +20,6 @@ jobs: uses: actions/setup-python@v2 with: python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - 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 - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest - name: PyInstaller Linux # You may pin to the exact commit or the version. # uses: JackMcKew/pyinstaller-action-linux@38639c352a36917eea765f9283bfd1092c28af7b From aa64b74859e716a539b3ac2e36139be1391e9f83 Mon Sep 17 00:00:00 2001 From: Conor Walker <2089327w@student.gla.ac.uk> Date: Tue, 25 Jan 2022 22:57:10 +0000 Subject: [PATCH 04/12] rename + reshuffle --- main.py => src/pydle.py | 2 +- src/pydle.spec | 40 +++++++++++++++++++++++++++++ words.txt => src/resource/words.txt | 0 3 files changed, 41 insertions(+), 1 deletion(-) rename main.py => src/pydle.py (96%) create mode 100644 src/pydle.spec rename words.txt => src/resource/words.txt (100%) diff --git a/main.py b/src/pydle.py similarity index 96% rename from main.py rename to src/pydle.py index 5c282ed..ad6907b 100644 --- a/main.py +++ b/src/pydle.py @@ -22,7 +22,7 @@ def resource_path(relative_path): def getWord(): - lines = open(resource_path('words.txt')).read().splitlines() + lines = open(resource_path('resource/words.txt')).read().splitlines() return random.choice(lines) diff --git a/src/pydle.spec b/src/pydle.spec new file mode 100644 index 0000000..189460b --- /dev/null +++ b/src/pydle.spec @@ -0,0 +1,40 @@ +# -*- mode: python ; coding: utf-8 -*- + + +block_cipher = None + + +a = Analysis(['pydle.py'], + pathex=[], + binaries=[], + datas=[('resource\\words.txt', '.')], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False) +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) + +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='pydle', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + disable_windowed_traceback=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None ) diff --git a/words.txt b/src/resource/words.txt similarity index 100% rename from words.txt rename to src/resource/words.txt From 5e0f80492df6c5cfc97b263d712a46f9811cdfcb Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 22:58:23 +0000 Subject: [PATCH 05/12] Update python-app.yml --- .github/workflows/python-app.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index f508f66..8498af9 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -26,12 +26,27 @@ jobs: uses: JackMcKew/pyinstaller-action-linux@0.1.4 with: # Directory containing source code & .spec file (optional requirements.txt). - path: '' + path: src # Specify a custom URL for PYPI pypi_url: https://pypi.python.org/ # Specify a custom URL for PYPI Index pypi_index_url: https://pypi.python.org/simple # Specify a file path for .spec file - spec: '' + spec: src/pydle.spec + # Specify whether to install Tkinter or not + tkinter: false + - name: PyInstaller Windows + # You may pin to the exact commit or the version. + # uses: JackMcKew/pyinstaller-action-windows@a8dee21ad01bbc7e7363d445bb632691b95ba057 + uses: JackMcKew/pyinstaller-action-windows@v0.1.2 + with: + # Directory containing source code (optional requirements.txt). + path: src + # Specify a custom URL for PYPI + pypi_url: https://pypi.python.org/ + # Specify a custom URL for PYPI Index + pypi_index_url: https://pypi.python.org/simple + # Specify a file path for .spec file + spec: src/pydle.spec # Specify whether to install Tkinter or not tkinter: false From ad16c576670076aca5b236b10f2e31368a30c702 Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 23:01:44 +0000 Subject: [PATCH 06/12] Update python-app.yml --- .github/workflows/python-app.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 8498af9..7216dc3 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -32,7 +32,7 @@ jobs: # Specify a custom URL for PYPI Index pypi_index_url: https://pypi.python.org/simple # Specify a file path for .spec file - spec: src/pydle.spec + spec: pydle.spec # Specify whether to install Tkinter or not tkinter: false - name: PyInstaller Windows @@ -47,6 +47,4 @@ jobs: # Specify a custom URL for PYPI Index pypi_index_url: https://pypi.python.org/simple # Specify a file path for .spec file - spec: src/pydle.spec - # Specify whether to install Tkinter or not - tkinter: false + spec: pydle.spec From 7317e1020f6a9569b6023d95cbfe1fc86accd202 Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 23:05:16 +0000 Subject: [PATCH 07/12] remove hooksconfig to see if that stops ci breakin --- src/pydle.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pydle.spec b/src/pydle.spec index 189460b..aa399da 100644 --- a/src/pydle.spec +++ b/src/pydle.spec @@ -10,7 +10,6 @@ a = Analysis(['pydle.py'], datas=[('resource\\words.txt', '.')], hiddenimports=[], hookspath=[], - hooksconfig={}, runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, From 7d53bf1b36293ae9de5fb56eee1c2e3339a49fa5 Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 23:10:42 +0000 Subject: [PATCH 08/12] upload artifact? --- .github/workflows/python-app.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 7216dc3..7168761 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -48,3 +48,7 @@ jobs: pypi_index_url: https://pypi.python.org/simple # Specify a file path for .spec file spec: pydle.spec + - uses: actions/upload-artifact@v2 + with: + name: pydle.exe + path: src/dist/windows From 66274f1d23731dd1bed657431ddbbf74a1014b8c Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 23:21:21 +0000 Subject: [PATCH 09/12] test \\ to / --- src/pydle.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pydle.spec b/src/pydle.spec index aa399da..b040ca0 100644 --- a/src/pydle.spec +++ b/src/pydle.spec @@ -7,7 +7,7 @@ block_cipher = None a = Analysis(['pydle.py'], pathex=[], binaries=[], - datas=[('resource\\words.txt', '.')], + datas=[('resource/words.txt', '.')], hiddenimports=[], hookspath=[], runtime_hooks=[], From 415b31778cc1902bfebddc2627318a8dbb1e8107 Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 23:26:20 +0000 Subject: [PATCH 10/12] adds linux artifact though missing filename --- .github/workflows/python-app.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 7168761..a742af0 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -52,3 +52,6 @@ jobs: with: name: pydle.exe path: src/dist/windows + - uses: actions/upload-artifact@v2 + with: + path: src/dist/linux From 0cd3a3ced954fa791661e929e4fd4c7d6ae1f835 Mon Sep 17 00:00:00 2001 From: Conor Walker <39270500+conor-walker@users.noreply.github.com> Date: Tue, 25 Jan 2022 23:29:51 +0000 Subject: [PATCH 11/12] realised what the name parameter does --- .github/workflows/python-app.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index a742af0..95368a5 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -50,8 +50,9 @@ jobs: spec: pydle.spec - uses: actions/upload-artifact@v2 with: - name: pydle.exe + name: pydleWindows path: src/dist/windows - uses: actions/upload-artifact@v2 with: + name: pydleUnix path: src/dist/linux From 6a72c2cfb53a93ab2bd47fac856d9cef4479aa50 Mon Sep 17 00:00:00 2001 From: Conor Walker <2089327w@student.gla.ac.uk> Date: Wed, 26 Jan 2022 00:06:37 +0000 Subject: [PATCH 12/12] reshuffles --- src/pydle.py | 2 +- src/pydle.spec | 2 +- src/{resource => }/words.txt | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename src/{resource => }/words.txt (100%) diff --git a/src/pydle.py b/src/pydle.py index ad6907b..5c282ed 100644 --- a/src/pydle.py +++ b/src/pydle.py @@ -22,7 +22,7 @@ def resource_path(relative_path): def getWord(): - lines = open(resource_path('resource/words.txt')).read().splitlines() + lines = open(resource_path('words.txt')).read().splitlines() return random.choice(lines) diff --git a/src/pydle.spec b/src/pydle.spec index b040ca0..9e77367 100644 --- a/src/pydle.spec +++ b/src/pydle.spec @@ -7,7 +7,7 @@ block_cipher = None a = Analysis(['pydle.py'], pathex=[], binaries=[], - datas=[('resource/words.txt', '.')], + datas=[('words.txt', '.')], hiddenimports=[], hookspath=[], runtime_hooks=[], diff --git a/src/resource/words.txt b/src/words.txt similarity index 100% rename from src/resource/words.txt rename to src/words.txt