Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publishing documentation #2384

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ 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: # Temporary just for test
branches:
- main
Comment on lines +12 to +14
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this for the sake of testing in my PR, but if we keep this we wouldn't need to add a test in .github/workflows/main.yml


jobs:
decompile:
generate:
runs-on: windows-latest

steps:
Expand All @@ -22,44 +25,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
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ 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 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

Comment on lines +46 to +52
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we merged both workflows, we could push these as artifacts, then no need to download from PyPI

- 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.
Expand Down
2 changes: 1 addition & 1 deletion AutoDuck/README → AutoDuck/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 8 additions & 9 deletions AutoDuck/common_top.mak
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator Author

@Avasam Avasam Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you still want this to be runnable w/o the python script, I think this should work to add a default executable location:

Suggested change
HHC = hhc
HHC = hhc
# PYTHON is set in make.py, defaulting to the one found on PATH
PYTHON = python

4 changes: 3 additions & 1 deletion AutoDuck/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Loading