mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 18:57:34 +02:00
Install deps in github actions instead of script
This commit is contained in:
2
.github/workflows/doc.yml
vendored
2
.github/workflows/doc.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
run: |
|
run: |
|
||||||
sudo apt install doxygen
|
sudo apt install doxygen python-virtualenv
|
||||||
sudo npm install -g less clean-css
|
sudo npm install -g less clean-css
|
||||||
cmake -E make_directory ${{runner.workspace}}/build
|
cmake -E make_directory ${{runner.workspace}}/build
|
||||||
|
|
||||||
|
@ -13,16 +13,6 @@ def rmtree_if_exists(dir):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def install_dependencies():
|
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'
|
deb_file = 'doxygen_1.8.6-2_amd64.deb'
|
||||||
urllib.urlretrieve('http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' +
|
urllib.urlretrieve('http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' +
|
||||||
deb_file, deb_file)
|
deb_file, deb_file)
|
||||||
@ -38,15 +28,21 @@ import build
|
|||||||
build.create_build_env()
|
build.create_build_env()
|
||||||
html_dir = build.build_docs()
|
html_dir = build.build_docs()
|
||||||
repo = 'fmtlib.github.io'
|
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:
|
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
|
# Don't update the repo if building in CI from an account that doesn't have
|
||||||
# push access.
|
# push access.
|
||||||
print('Skipping update of ' + repo)
|
print('Skipping update of ' + repo)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
# Clone the fmtlib.github.io repo.
|
# Clone the fmtlib.github.io repo.
|
||||||
rmtree_if_exists(repo)
|
rmtree_if_exists(repo)
|
||||||
git_url = 'https://github.com/' if is_ci else 'git@github.com:'
|
git_url = 'https://github.com/' if is_ci else 'git@github.com:'
|
||||||
check_call(['git', 'clone', git_url + 'fmtlib/{}.git'.format(repo)])
|
check_call(['git', 'clone', git_url + 'fmtlib/{}.git'.format(repo)])
|
||||||
|
|
||||||
# Copy docs to the repo.
|
# Copy docs to the repo.
|
||||||
target_dir = os.path.join(repo, 'dev')
|
target_dir = os.path.join(repo, 'dev')
|
||||||
rmtree_if_exists(target_dir)
|
rmtree_if_exists(target_dir)
|
||||||
@ -54,6 +50,7 @@ shutil.copytree(html_dir, target_dir, ignore=shutil.ignore_patterns('.*'))
|
|||||||
if is_ci:
|
if is_ci:
|
||||||
check_call(['git', 'config', '--global', 'user.name', 'fmtbot'])
|
check_call(['git', 'config', '--global', 'user.name', 'fmtbot'])
|
||||||
check_call(['git', 'config', '--global', 'user.email', 'viz@fmt.dev'])
|
check_call(['git', 'config', '--global', 'user.email', 'viz@fmt.dev'])
|
||||||
|
|
||||||
# Push docs to GitHub pages.
|
# Push docs to GitHub pages.
|
||||||
check_call(['git', 'add', '--all'], cwd=repo)
|
check_call(['git', 'add', '--all'], cwd=repo)
|
||||||
if call(['git', 'diff-index', '--quiet', 'HEAD'], cwd=repo):
|
if call(['git', 'diff-index', '--quiet', 'HEAD'], cwd=repo):
|
||||||
|
Reference in New Issue
Block a user