From abf479c6171565a6abdd2075046dd2f6b6bea93d Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Sun, 24 Mar 2024 20:06:58 +0300 Subject: [PATCH 1/8] Add workflow to build windows executable --- .github/workflows/build.yaml | 19 +++++++++++++++++++ README.md | 12 ++++++------ 1cv8_postgres_helper.py => src/main.py | 0 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100755 .github/workflows/build.yaml rename 1cv8_postgres_helper.py => src/main.py (100%) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100755 index 0000000..2459d77 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,19 @@ +name: Build & release +on: + push: + tags: [v**] + branches: ['*'] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Package Application + uses: JackMcKew/pyinstaller-action-windows@main + with: + path: src + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: dist/1cv8_postgres_helper.exe diff --git a/README.md b/README.md index 4538eba..812876c 100644 --- a/README.md +++ b/README.md @@ -5,18 +5,18 @@ ## Показать встроенную справку -```sh -python 1cv8_postgres_helper.py --help +```powershell +1cv8_postgres_helper.exe --help ``` ## Наиболее простой вариант -```sh -python 1cv8_postgres_helper.py --config postgresql.example.conf --mem 32GB +```powershell +1cv8_postgres_helper.exe --config postgresql.example.conf --mem 32GB ``` ## Все доступные аргументы -```sh -python 1cv8_postgres_helper.py --config postgresql.example.conf --mem 32GB --cpu 8 --storage ssd --disable-synchronous-commit --enable-group-commit --no-backup +```powershell +1cv8_postgres_helper.exe --config postgresql.example.conf --mem 32GB --cpu 8 --storage ssd --disable-synchronous-commit --enable-group-commit --no-backup ``` diff --git a/1cv8_postgres_helper.py b/src/main.py similarity index 100% rename from 1cv8_postgres_helper.py rename to src/main.py From 9d05090ce359d6ed63029ea24d0880b8b61c78d2 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Sun, 24 Mar 2024 20:09:13 +0300 Subject: [PATCH 2/8] Do not create release for now, only build on push --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2459d77..0f37428 100755 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,5 +15,6 @@ jobs: path: src - name: Release uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') with: files: dist/1cv8_postgres_helper.exe From d98428f5ed6bad709d0c274c9cc084edb572d1b8 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Sun, 24 Mar 2024 20:11:51 +0300 Subject: [PATCH 3/8] Validate that build generates executable --- .github/workflows/build.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0f37428..b54aa95 100755 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,6 +13,13 @@ jobs: uses: JackMcKew/pyinstaller-action-windows@main with: path: src + - name: Check file existence + uses: andstor/file-existence-action@v3 + with: + files: dist/1cv8_postgres_helper.exe + - name: File exists + if: steps.check_files.outputs.files_exists == 'true' + run: echo All files exists! - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') From 03c9a40917b3771dd186b888406bc4f9afae0a41 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Sun, 24 Mar 2024 20:31:02 +0300 Subject: [PATCH 4/8] Try to fix build --- .github/workflows/build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b54aa95..415e3ee 100755 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,8 +11,6 @@ jobs: uses: actions/checkout@v4 - name: Package Application uses: JackMcKew/pyinstaller-action-windows@main - with: - path: src - name: Check file existence uses: andstor/file-existence-action@v3 with: From 72de148eb66d7d00a6b5d1c6741f26695803a922 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Sun, 24 Mar 2024 20:42:55 +0300 Subject: [PATCH 5/8] Add build spec --- .github/workflows/build.yaml | 2 ++ .gitignore | 1 - src/build.spec | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/build.spec diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 415e3ee..b54aa95 100755 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,6 +11,8 @@ jobs: uses: actions/checkout@v4 - name: Package Application uses: JackMcKew/pyinstaller-action-windows@main + with: + path: src - name: Check file existence uses: andstor/file-existence-action@v3 with: diff --git a/.gitignore b/.gitignore index dc20fd0..22ad483 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ MANIFEST # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest -*.spec # Installer logs pip-log.txt diff --git a/src/build.spec b/src/build.spec new file mode 100644 index 0000000..16c7913 --- /dev/null +++ b/src/build.spec @@ -0,0 +1,20 @@ +a = Analysis(['main.py'], + hiddenimports=[], + hookspath=None, + runtime_hooks=None, + ) +pyz = PYZ(a.pure) + +options = [('u', None, 'OPTION')] + +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + options, + name='1cv8_postgres_helper', + debug=False, + strip=None, + upx=True, + ) From 9915d46a17bbbdb79d9797c2ed8ce367dd0d6884 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Sun, 24 Mar 2024 20:45:34 +0300 Subject: [PATCH 6/8] Now lets find out where is builded file --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b54aa95..03e1bd8 100755 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: - name: Check file existence uses: andstor/file-existence-action@v3 with: - files: dist/1cv8_postgres_helper.exe + files: dist/windows/1cv8_postgres_helper.exe - name: File exists if: steps.check_files.outputs.files_exists == 'true' run: echo All files exists! @@ -24,4 +24,4 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: - files: dist/1cv8_postgres_helper.exe + files: dist/windows/1cv8_postgres_helper.exe From 6920c2b54af84580f7e107545dab6a1720c48baf Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Sun, 24 Mar 2024 20:49:45 +0300 Subject: [PATCH 7/8] One more try --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 03e1bd8..aa234dd 100755 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: - name: Check file existence uses: andstor/file-existence-action@v3 with: - files: dist/windows/1cv8_postgres_helper.exe + files: src/dist/windows/1cv8_postgres_helper.exe - name: File exists if: steps.check_files.outputs.files_exists == 'true' run: echo All files exists! @@ -24,4 +24,4 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: - files: dist/windows/1cv8_postgres_helper.exe + files: src/dist/windows/1cv8_postgres_helper.exe From abbea4b27a5cb5befd69f258afca7ad174b5bfd7 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Sun, 24 Mar 2024 20:52:04 +0300 Subject: [PATCH 8/8] Ready to publish release --- .github/workflows/build.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index aa234dd..de38ba9 100755 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,7 +2,6 @@ name: Build & release on: push: tags: [v**] - branches: ['*'] jobs: build: runs-on: ubuntu-latest @@ -13,15 +12,7 @@ jobs: uses: JackMcKew/pyinstaller-action-windows@main with: path: src - - name: Check file existence - uses: andstor/file-existence-action@v3 - with: - files: src/dist/windows/1cv8_postgres_helper.exe - - name: File exists - if: steps.check_files.outputs.files_exists == 'true' - run: echo All files exists! - name: Release uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') with: files: src/dist/windows/1cv8_postgres_helper.exe