From 701ed6c874c052c702e46d9c018f4c5e33e15e1b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 7 Nov 2020 11:16:38 -0800 Subject: [PATCH] Install deps in github actions instead of script --- .github/workflows/doc.yml | 2 +- support/build-docs.py | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index c55e2ecb..79883795 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -11,7 +11,7 @@ jobs: - name: Create Build Environment run: | - sudo apt install doxygen + sudo apt install doxygen python-virtualenv sudo npm install -g less clean-css cmake -E make_directory ${{runner.workspace}}/build diff --git a/support/build-docs.py b/support/build-docs.py index 2fddecd0..e3d739ef 100755 --- a/support/build-docs.py +++ b/support/build-docs.py @@ -13,16 +13,6 @@ def rmtree_if_exists(dir): pass def install_dependencies(): - branch = os.environ['GITHUB_REF'] - if branch != 'refs/heads/master': - print('Branch: ' + branch) - exit(0) # Ignore non-master branches - check_call('curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key ' + - '| sudo apt-key add -', shell=True) - check_call('echo "deb https://deb.nodesource.com/node_0.10 precise main" ' + - '| sudo tee /etc/apt/sources.list.d/nodesource.list', shell=True) - check_call(['sudo', 'apt-get', 'update']) - check_call(['sudo', 'apt-get', 'install', 'python-virtualenv']) deb_file = 'doxygen_1.8.6-2_amd64.deb' urllib.urlretrieve('http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' + deb_file, deb_file) @@ -38,15 +28,21 @@ import build build.create_build_env() html_dir = build.build_docs() repo = 'fmtlib.github.io' +branch = os.environ['GITHUB_REF'] +if is_ci and branch != 'refs/heads/master': + print('Branch: ' + branch) + exit(0) # Ignore non-master branches if is_ci and 'KEY' not in os.environ: # Don't update the repo if building in CI from an account that doesn't have # push access. print('Skipping update of ' + repo) exit(0) + # Clone the fmtlib.github.io repo. rmtree_if_exists(repo) git_url = 'https://github.com/' if is_ci else 'git@github.com:' check_call(['git', 'clone', git_url + 'fmtlib/{}.git'.format(repo)]) + # Copy docs to the repo. target_dir = os.path.join(repo, 'dev') rmtree_if_exists(target_dir) @@ -54,6 +50,7 @@ shutil.copytree(html_dir, target_dir, ignore=shutil.ignore_patterns('.*')) if is_ci: check_call(['git', 'config', '--global', 'user.name', 'fmtbot']) check_call(['git', 'config', '--global', 'user.email', 'viz@fmt.dev']) + # Push docs to GitHub pages. check_call(['git', 'add', '--all'], cwd=repo) if call(['git', 'diff-index', '--quiet', 'HEAD'], cwd=repo):