From 9758b20437e43be7dce976aa3ef40096975b3ee3 Mon Sep 17 00:00:00 2001 From: Colin Unger Date: Tue, 17 Mar 2026 20:42:17 -0700 Subject: [PATCH 1/3] Add docs auto-deploy to CI --- .github/workflows/helpers/deploy-docs.py | 63 ++++++++++++++++++++++++ .github/workflows/tests.yml | 7 +++ 2 files changed, 70 insertions(+) create mode 100755 .github/workflows/helpers/deploy-docs.py diff --git a/.github/workflows/helpers/deploy-docs.py b/.github/workflows/helpers/deploy-docs.py new file mode 100755 index 0000000000..302b8320e6 --- /dev/null +++ b/.github/workflows/helpers/deploy-docs.py @@ -0,0 +1,63 @@ +#! /usr/bin/env python3 + +import os +import tempfile +import subprocess +from typing import Tuple +from pathlib import Path +import shlex + +KNOWN_HOSTS = ''' +flexflow.ai ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAING3BmAIYc0G5hxIFPqQrgLjCt2t4vlRaLxds3QY6MaE +''' + +def create_ssh_key_file(d: Path) -> Tuple[Path, Path]: + d.chmod(0o700) + + ssh_private_key_path = d / 'id_ed25519' + ssh_private_key_path.touch(mode=0o600, exist_ok=False) + + ssh_known_hosts_path = d / 'known_hosts' + ssh_known_hosts_path.touch(mode=0o600, exist_ok=False) + + ssh_private_key_path.write_text(os.environ['SSH_PRIVATE_KEY'] + '\n') + ssh_known_hosts_path.write_text(KNOWN_HOSTS) + + return ssh_private_key_path, ssh_known_hosts_path + +def deploy(ssh_private_key_path: Path, ssh_known_hosts_path: Path) -> None: + assert ssh_private_key_path.is_file() + assert ssh_known_hosts_path.is_file() + + docs_html_dir = Path('./build/doxygen/html/') + assert docs_html_dir.is_dir() + assert (docs_html_dir / 'index.html').is_file() + + ssh_command = shlex.join([ + 'ssh', '-i', str(ssh_private_key_path), '-o', f'UserKnownHostsFile={ssh_known_hosts_path}', + ]) + print(ssh_command) + subprocess.run( + [ + 'rsync', + '--delete', + '--recursive', + '--verbose', + '--human-readable', + f'--rsh={ssh_command}', + str(docs_html_dir), + 'deploy-ff-train-docs@flexflow.ai:/opt/www/ff-train-docs/', + ], + check=True, + ) + +if __name__ == '__main__': + with tempfile.TemporaryDirectory() as _d: + d = Path(_d) + + ssh_private_key_path, ssh_known_hosts_path = create_ssh_key_file(d) + + deploy( + ssh_private_key_path=ssh_private_key_path, + ssh_known_hosts_path=ssh_known_hosts_path, + ) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 799e3069a9..7882c300c9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,6 +43,13 @@ jobs: run: | proj check cpu-ci + - name: Deploy docs to flexflow.ai + env: + SSH_PRIVATE_KEY: ${{secrets.DOCS_SSH_PRIVATE_KEY}} + if: ${{ success() && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.ref == 'refs/heads/auto-deploy-docs' }} + run: | + ./.github/workflows/helpers/deploy-docs.py + - name: Upload code coverage uses: codecov/codecov-action@v4 with: From 1c598558b3c461eb88a8f5f41e93a5996b7337a7 Mon Sep 17 00:00:00 2001 From: Colin Unger Date: Tue, 17 Mar 2026 21:14:37 -0700 Subject: [PATCH 2/3] Prevent nested html directory in docs deployment --- .github/workflows/helpers/deploy-docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helpers/deploy-docs.py b/.github/workflows/helpers/deploy-docs.py index 302b8320e6..353997d59e 100755 --- a/.github/workflows/helpers/deploy-docs.py +++ b/.github/workflows/helpers/deploy-docs.py @@ -45,7 +45,7 @@ def deploy(ssh_private_key_path: Path, ssh_known_hosts_path: Path) -> None: '--verbose', '--human-readable', f'--rsh={ssh_command}', - str(docs_html_dir), + str(docs_html_dir) + '/', 'deploy-ff-train-docs@flexflow.ai:/opt/www/ff-train-docs/', ], check=True, From 56385be366de6d0d0a7650db65e6a9e44257d093 Mon Sep 17 00:00:00 2001 From: Colin Unger Date: Tue, 17 Mar 2026 22:29:35 -0700 Subject: [PATCH 3/3] Update deployed branch name to master --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7882c300c9..9248e1d7ea 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,7 +46,7 @@ jobs: - name: Deploy docs to flexflow.ai env: SSH_PRIVATE_KEY: ${{secrets.DOCS_SSH_PRIVATE_KEY}} - if: ${{ success() && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.ref == 'refs/heads/auto-deploy-docs' }} + if: ${{ success() && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.ref == 'refs/heads/master' }} run: | ./.github/workflows/helpers/deploy-docs.py