Use Travis CI to automate build and deploy.

Latest octo.js will always be on github pages.
This commit is contained in:
Jesse Schwartzentruber 2017-06-07 11:42:09 -04:00
parent 2262c9a2b5
commit 1f061e996f
3 changed files with 28 additions and 1727 deletions

View File

@ -8,6 +8,17 @@ addons:
firefox: latest
before_script:
- sh -e /etc/init.d/xvfb start
script:
- mkdir -p deploy
- ./build.py -l lib -d deploy
notifications:
slack:
secure: Kwe1KBh4SMzgXaj6GQg3ZmopRYcDR3Vnd4C/gyiEOJsXzKRlU5dA7WwM/mbyOe9+ZvWDyp+g2CoQYYyvLR0SHEy1m0gn6M8fBzgSZQlWxOxAJxkwVsyxUNwAy2FylMpS+ugpw/fBMSbnSFqfZSa/tGB3KhBc0yA7V9wVS0hnwBfICqKKlFdLPcp+Us4zpXRUmcL1e0BVwm2klJi0CoKlOmTa4lI3tUa/YiuuMpgk89/PioMEr6/PP+5OfWV624djw2gznoualvcwdfZniC/oxkdTUbcu4nbTf+bFk5uwwW+XBpUhm9rMUoftngYCrWdtYHS6qenyzmflO5bgCDg5W8onv3qgMcDTEHDjlO8JMoEQLC2o27Hsyukrh2Iu0Hn2k4S10ZIDWLUZXf8ERKdU7v8o5xaiCrP7NO8fJlyGbWwYxwpFi9dpacb8qWuWw53k8+ld9orl2Zu5t1Y1QJCvT0DP0iGYSxbbICfex7im0fgh3A+MHTfhxxiGQtFJRUxqO5wGCIsT4dJJkYwRJ1HoCPyLT1x1WT8iy4lr8ivRhanEwQ5g2OmuRKz522yCrm2DPaRR/LDhqK9xghJqqh4RNx9Be5xNaxSxKs4Hcya4ZXrGaU9tzGTehRkNQksKUHq9PpdY85Mbk84wEq7zKLhtLPTn17DQePFm2DbdX4392o4=
deploy:
provider: pages
api_key:
secure: HszUovTqcRxuXTmH3/rStEe1ZeZbrZweQah8Bq0POs89P3/GjyEat11WbH9S7tfIT1yVcF736TmsDNRtl34Rmr71P7rczwFlX1yJOIamH4jT9vG8ocpZH4Orc6XA2s7UclD1HwJwStM1k2J4CV34eTTlX36ngjYrp09HertXAQWSK6TZk9RK6ql2HlNzchImz2EY1aQnfqkrFByOtM4o/SJJryJJBJUMD69gWrYu6cv51w/jMEoUtzvV6Nr2o9YOuo97B0scJmbxgfx67FaCQwEOxKtr8xT5nttJ2q6EeaAiErAieG8/o8yRsJRFrHyVm42v9PEfoe8O8Y4g/1VrtbjY3vH8LPpCotMxhshjUCBaLDc8TCC/osik6dxhv/fqjbdPwrGRW2qzsmXIZug7+YCEW+qUFRPwwX+Cr0ENnaPFMSDFxANeLF7KfF7oaVnr8JTlZnu9G+Uliqe6RNCoWfQtpTRM759cDLQp4b5eBQF2G61x2XOdRqcNZepRaRVnsaCo0lNPW9o5HCQnJnMbEB9Gdowt18PwgVucIdIPJeAPodMs40s7sUOP5Xik58b4YBG9lsgLBcfCgTy+n8JPS2LJsclG82pBACtSV+ucc6rVeD+5fbSUxn4ItaK4e0MonCv4Jnp7zGn6hErcpexBmXSdYQSrdsemKDTGHibOF6U=
local_dir: deploy
skip_cleanup: true
on:
branch: master

32
build.py Normal file → Executable file
View File

@ -1,25 +1,27 @@
#!/usr/bin/env python
# coding=utf-8
from __future__ import print_function
import argparse
import os
import sys
from shutil import copy
# List of files which must be loaded first
preload = [
PRELOAD = (
'random/random.js',
'random/mersennetwister.js',
'utils/init.js',
'utils/platform.js',
'logging/console.js',
'make/init.js'
]
)
def argparser():
parser = argparse.ArgumentParser()
parser.add_argument('-l', '--libs', required=True, help='Directory containing the octo libraries.')
parser.add_argument('-d', '--deploy', required=True, help='Directory where the combined octo library will be built.')
parser.add_argument('-l', '--libs', required=True,
help='Directory containing the octo libraries.')
parser.add_argument('-d', '--deploy', required=True,
help='Directory where the combined octo library will be built.')
args = parser.parse_args()
if not os.path.isdir(args.libs):
@ -34,28 +36,28 @@ def main():
args = argparser()
data = []
loaded = []
loaded = set()
for filename in preload:
for filename in PRELOAD:
path = os.path.join(args.libs, filename)
if not os.path.isfile(path):
raise Exception("Unable to find file in preload: {0}".format(path))
print("Adding path: {0}".format(path))
with open(path) as f:
with open(path, 'rb') as f:
data.append(f.read())
loaded.append(path)
loaded.add(path)
for root, dirs, files in os.walk(args.libs):
for root, _, files in os.walk(args.libs):
for filename in files:
path = os.path.join(root, filename)
if path.endswith('.js') and path not in loaded:
print("Adding path: {0}".format(path))
with open(path) as f:
with open(path, 'rb') as f:
data.append(f.read())
octo_path = os.path.join(args.deploy, 'octo.js')
with open(octo_path, 'w') as f:
f.write('\n\n'.join(data))
with open(octo_path, 'wb') as f:
f.write(b'\n\n'.join(data))
if __name__ == "__main__":

File diff suppressed because one or more lines are too long