From 63f730c5e87e12a37eb4c93b6ca91d78c743a2f5 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 6 Oct 2024 13:18:19 -0400 Subject: [PATCH 1/5] Fix publishing documentation --- .github/workflows/docs.yml | 38 ++++++++++++++++------------------ AutoDuck/{README => README.md} | 2 +- AutoDuck/common_top.mak | 17 +++++++-------- AutoDuck/make.py | 4 +++- 4 files changed, 30 insertions(+), 31 deletions(-) rename AutoDuck/{README => README.md} (77%) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index edeb8e066..b679e54fd 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,15 +3,22 @@ name: docs on: create: tags: - # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - b[0-9][0-9][0-9] - publish-docs* push: branches: - main + pull_request: + branches: + - main + paths: + - 'AutoDuck/**' + - '**/.html' + - .github/workflows/docs.yml jobs: - decompile: + generate: runs-on: windows-latest steps: @@ -19,47 +26,38 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Install latest release - run: pip install --user --upgrade pywin32 + - name: Generate help file + run: python AutoDuck/make.py - - name: Set Python user site directory - run: python -c "import os,site;open(os.environ['GITHUB_ENV'], 'a').write(f'USER_DIR={site.USER_SITE}\n')" - - - name: Decompile shipped help file - run: hh -decompile site ${env:USER_DIR}\PyWin32.chm + - name: Decompile help file + run: hh -decompile site PyWin32.chm - name: Rename root HTML file run: mv site\PyWin32.HTML site\index.html - # Compress first to avoid slowly uploading thousands of individual files - - name: Create archive - run: python -m zipfile -c site.zip site - - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: documentation - path: site.zip + path: site/ publish: runs-on: ubuntu-latest needs: - - decompile + - generate # Only publish tags if: github.event_name == 'create' && github.event.ref_type == 'tag' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: documentation - name: Unpack archive run: python -m zipfile -e site.zip . - - uses: peaceiris/actions-gh-pages@v3 + - uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site diff --git a/AutoDuck/README b/AutoDuck/README.md similarity index 77% rename from AutoDuck/README rename to AutoDuck/README.md index 5d0520aed..192828d79 100644 --- a/AutoDuck/README +++ b/AutoDuck/README.md @@ -1,4 +1,4 @@ -Just run MAKE.BAT to build the documentation. +Just run [make.py](./make.py) to build the documentation. Main focus these days is on the .chm file - a single .chm provides the best documentation solution. We don't even diff --git a/AutoDuck/common_top.mak b/AutoDuck/common_top.mak index a76ffcda9..a2ebbd9e0 100644 --- a/AutoDuck/common_top.mak +++ b/AutoDuck/common_top.mak @@ -1,13 +1,12 @@ # Common AutoDuck make file -AD = bin\autoduck.exe /Spythonwin.fmt +AD = bin\autoduck.exe /Spythonwin.fmt ADHTMLFMT = bin\autoduck.exe /Spyhtml.fmt ADHTMLLOG = /R html "/L$(GENDIR)\$(TARGET).HHLOG" /N -ADLOG = /R help "/L$(GENDIR)\$(TARGET).HLOG" /N -ADHTML = /R html "/G$(GENDIR)\$(TARGET).DUMP" "/C$(GENDIR)\$(TARGET).HHLOG" "/I$(GENDIR)\$(TARGET).IDX" "/O$(GENDIR)\$(TARGET).HTML" /D "title=$(TITLE)" -ADHLP = /R help "/C$(GENDIR)\$(TARGET).HLOG" "/O$(GENDIR)\$(TARGET).RTF" /D "title=$(TITLE)" -ADDOC = /RD "/O$(GENDIR)\$(TARGET).DOC" /D "doc_header=$(DOCHDR)" -ADTAB = 8 -HC = hcw /a /c /e -HHC = hhc -PYTHON = py -2.7 +ADLOG = /R help "/L$(GENDIR)\$(TARGET).HLOG" /N +ADHTML = /R html "/G$(GENDIR)\$(TARGET).DUMP" "/C$(GENDIR)\$(TARGET).HHLOG" "/I$(GENDIR)\$(TARGET).IDX" "/O$(GENDIR)\$(TARGET).HTML" /D "title=$(TITLE)" +ADHLP = /R help "/C$(GENDIR)\$(TARGET).HLOG" "/O$(GENDIR)\$(TARGET).RTF" /D "title=$(TITLE)" +ADDOC = /RD "/O$(GENDIR)\$(TARGET).DOC" /D "doc_header=$(DOCHDR)" +ADTAB = 8 +HC = hcw /a /c /e +HHC = hhc diff --git a/AutoDuck/make.py b/AutoDuck/make.py index d3b9ee39a..c205aa0da 100644 --- a/AutoDuck/make.py +++ b/AutoDuck/make.py @@ -26,5 +26,7 @@ ).splitlines()[-1] subprocess.run( - [nmake, "-E", "-f", "pywin32.mak"], cwd=os.path.dirname(sys.argv[0]), check=True + [nmake, f'PYTHON="{sys.executable}"', "-E", "-f", "pywin32.mak"], + cwd=os.path.dirname(sys.argv[0]), + check=True, ) From f2f0f0e9400c9d8a305ba13fd9a5c8c090b33899 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 14 Oct 2024 15:37:38 -0400 Subject: [PATCH 2/5] Discard changes to .github/workflows/docs.yml --- .github/workflows/docs.yml | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b679e54fd..edeb8e066 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,22 +3,15 @@ name: docs on: create: tags: - # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - b[0-9][0-9][0-9] - publish-docs* push: branches: - main - pull_request: - branches: - - main - paths: - - 'AutoDuck/**' - - '**/.html' - - .github/workflows/docs.yml jobs: - generate: + decompile: runs-on: windows-latest steps: @@ -26,38 +19,47 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 + with: + python-version: '3.9' - - name: Generate help file - run: python AutoDuck/make.py + - name: Install latest release + run: pip install --user --upgrade pywin32 - - name: Decompile help file - run: hh -decompile site PyWin32.chm + - name: Set Python user site directory + run: python -c "import os,site;open(os.environ['GITHUB_ENV'], 'a').write(f'USER_DIR={site.USER_SITE}\n')" + + - name: Decompile shipped help file + run: hh -decompile site ${env:USER_DIR}\PyWin32.chm - name: Rename root HTML file run: mv site\PyWin32.HTML site\index.html - - uses: actions/upload-artifact@v4 + # Compress first to avoid slowly uploading thousands of individual files + - name: Create archive + run: python -m zipfile -c site.zip site + + - uses: actions/upload-artifact@v3 with: name: documentation - path: site/ + path: site.zip publish: runs-on: ubuntu-latest needs: - - generate + - decompile # Only publish tags if: github.event_name == 'create' && github.event.ref_type == 'tag' steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v3 with: name: documentation - name: Unpack archive run: python -m zipfile -e site.zip . - - uses: peaceiris/actions-gh-pages@v4 + - uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site From 906bc465cd60c402f88014d7434eae3c71d3eccb Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 14 Oct 2024 16:49:55 -0400 Subject: [PATCH 3/5] Add step in main that generates help file --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aa1049f06..24d25670f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,12 @@ jobs: run: | python setup.py install --user + # This needs to happen *after* installing pywin32 since + # AutoDuck/py2d.py currently relies on runtime imports for introspection + # This also works as a sanity check for the docs.yaml workflow + - name: Generate PyWin32.chm help file + run: python AutoDuck/make.py + - name: Run tests # Run the tests directly from the source dir so support files (eg, .wav files etc) # can be found - they aren't installed into the Python tree. From e90a20e71be2270c4cdad902505eb69ffacd55da Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 14 Oct 2024 17:13:37 -0400 Subject: [PATCH 4/5] generate help file from download --- .github/workflows/docs.yml | 29 ++++++++++++++--------------- .github/workflows/main.yml | 3 ++- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index edeb8e066..2dac65813 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,7 +3,7 @@ name: docs on: create: tags: - # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - b[0-9][0-9][0-9] - publish-docs* push: @@ -11,7 +11,7 @@ on: - main jobs: - decompile: + generate: runs-on: windows-latest steps: @@ -22,44 +22,43 @@ jobs: with: python-version: '3.9' + # We still need to install pywin32 because + # AutoDuck/py2d.py currently relies on runtime imports for introspection + # Downloading latest release is faster than re-building - name: Install latest release run: pip install --user --upgrade pywin32 - - name: Set Python user site directory - run: python -c "import os,site;open(os.environ['GITHUB_ENV'], 'a').write(f'USER_DIR={site.USER_SITE}\n')" + - name: Generate PyWin32.chm help file + run: python AutoDuck/make.py - - name: Decompile shipped help file - run: hh -decompile site ${env:USER_DIR}\PyWin32.chm + - name: Decompile help file into HTML + run: hh -decompile site PyWin32.chm - name: Rename root HTML file run: mv site\PyWin32.HTML site\index.html - # Compress first to avoid slowly uploading thousands of individual files - - name: Create archive - run: python -m zipfile -c site.zip site - - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: documentation - path: site.zip + path: site/ publish: runs-on: ubuntu-latest needs: - - decompile + - generate # Only publish tags if: github.event_name == 'create' && github.event.ref_type == 'tag' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: documentation - name: Unpack archive run: python -m zipfile -e site.zip . - - uses: peaceiris/actions-gh-pages@v3 + - uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24d25670f..a1e401751 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,8 @@ jobs: # This needs to happen *after* installing pywin32 since # AutoDuck/py2d.py currently relies on runtime imports for introspection - # This also works as a sanity check for the docs.yaml workflow + # This isn't included in the wheel (TODO: could we?) + # and only servces as a PR test for the docs.yaml workflow - name: Generate PyWin32.chm help file run: python AutoDuck/make.py From 4e8bc34a7f107287ab5fd6bd66998c1942c5aa9c Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 14 Oct 2024 17:23:18 -0400 Subject: [PATCH 5/5] docs in PR --- .github/workflows/docs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2dac65813..0cb4702dd 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -9,6 +9,9 @@ on: push: branches: - main + pull_request: # Temporary just for test + branches: + - main jobs: generate: