diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..94df1bd --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,44 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ dev ] + pull_request: + branches: [ dev ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-18.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - uses: actions/setup-python@v2 + with: + python-version: '2.7' + - name: apt-get + run: sudo apt-get -qq install -y wget python-pip python2.7-dev libsdl1.2debian libfdt1 libpixman-1-0 nodejs npm libfreetype6 libx11-6 rlwrap + - name: virtualenv + run: pip install virtualenv + - name: get sdk + run: if [ ! -d sdk ]; then mkdir sdk && wget -q -O - https://developer.rebble.io/s3.amazonaws.com/assets.getpebble.com/pebble-tool/pebble-sdk-4.5-linux64.tar.bz2 | tar xj --strip-components=1 -C sdk; fi + - name: requirements + run: if [ ! -d sdk/.env ]; then cd sdk && virtualenv .env && bash -c "source .env/bin/activate && pip install -r requirements.txt && deactivate" && cd ..; fi + - name: sdk-core + run: if [ ! -f sdk/sdk-core-4.3.tar.bz2 ]; then wget https://github.com/aveao/PebbleArchive/raw/master/SDKCores/sdk-core-4.3.tar.bz2 -O sdk/sdk-core-4.3.tar.bz2; fi + - name: install sdk + run: if [ ! -d ~/.pebble-sdk ]; then mkdir -p ~/.pebble-sdk && touch ~/.pebble-sdk/NO_TRACKING && sdk/bin/pebble sdk install sdk/sdk-core-4.3.tar.bz2; fi + - name: make + run: make travis_build diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58c0e12 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.lock-waf_linux2_build +package-lock.json +build/ +node_modules/ +.ycm_extra_conf.py +makefile.ycm diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0aadbc7 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +# platform +#P="chalk" + +VERSION=$(shell cat package.json | grep version | grep -o "[0-9][0-9]*\.[0-9][0-9]*") +NAME=$(shell cat package.json | grep '"name":' | head -1 | sed 's/,//g' |sed 's/"//g' | awk '{ print $2 }') + +all: build install + +build: + pebble build + +config: + pebble emu-app-config --emulator $(PEBBLE_EMULATOR) + +travis_build: + yes | sdk/bin/pebble build + +install: + pebble install --emulator $(PEBBLE_EMULATOR) + +clean: + pebble clean + +size: + pebble analyze-size + +logs: + pebble logs --emulator $(PEBBLE_EMULATOR) + +phone-logs: + pebble logs --phone ${PEBBLE_PHONE} + +screenshot: + pebble screenshot --phone ${PEBBLE_PHONE} + +deploy: + pebble install --phone ${PEBBLE_PHONE} + +timeline-on: + pebble emu-set-timeline-quick-view on + +timeline-off: + pebble emu-set-timeline-quick-view off + +wipe: + pebble wipe + +.PHONY: all build config log install clean size logs screenshot deploy timeline-on timeline-off wipe phone-logs diff --git a/README.md b/README.md index d200c73..b355922 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # pebble-mss Pebble Watchface: Multifunctional Seven Segment + +![](Screenshot_2015-08-11_17.00_annotation.png?raw=true) diff --git a/before_install.sh b/before_install.sh new file mode 100644 index 0000000..e1ec73a --- /dev/null +++ b/before_install.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Install NPM 3 +npm install npm@3 -g + +set -e +echo 'pBuild 1.5' +echo 'Installing Pebble SDK and its Dependencies...' + +cd ~ + +mkdir -p ~/pebble-dev +mkdir -p ~/.pebble-sdk +touch ~/.pebble-sdk/ENABLE_ANALYTICS + +# Get the Pebble SDK and toolchain +if [ ! -d $HOME/pebble-dev/${PEBBLE_SDK} ]; then + wget https://s3.amazonaws.com/assets.getpebble.com/pebble-tool/${PEBBLE_SDK}.tar.bz2 + + # Extract the SDK + tar -jxf ${PEBBLE_SDK}.tar.bz2 -C ~/pebble-dev/ + # Install the Python library dependencies locally + cd ~/pebble-dev/${PEBBLE_SDK} + sed -i '286s/.*/ return requests.get("{}{}".format(self.DOWNLOAD_SERVER, path), *args, verify=False)/' pebble-tool/pebble_tool/sdk/manager.py + virtualenv --no-site-packages .env + source .env/bin/activate + pip install -r requirements.txt + deactivate + pip install -U pyopenssl==0.13.1 pyasn1 ndg-httpsclient + ~/pebble-dev/${PEBBLE_SDK}/bin/pebble sdk install https://github.com/aveao/PebbleArchive/raw/master/SDKCores/sdk-core-4.3.tar.bz2 +fi diff --git a/wscript b/wscript index b20f58f..5238bc8 100644 --- a/wscript +++ b/wscript @@ -1,62 +1,54 @@ - - # -# This file is the default set of rules to compile a Pebble project. +# +# This file is the default set of rules to compile a Pebble application. # # Feel free to customize this to your needs. # - import os.path -try: - from sh import CommandNotFound, jshint, cat, ErrorReturnCode_2 - hint = jshint -except (ImportError, CommandNotFound): - hint = None top = '.' out = 'build' + def options(ctx): ctx.load('pebble_sdk') + def configure(ctx): + """ + This method is used to configure your build. ctx.load(`pebble_sdk`) automatically configures + a build for each valid platform in `targetPlatforms`. Platform-specific configuration: add your + change after calling ctx.load('pebble_sdk') and make sure to set the correct environment first. + Universal configuration: add your change prior to calling ctx.load('pebble_sdk'). + """ ctx.load('pebble_sdk') -def build(ctx): - if False and hint is not None: - try: - hint([node.abspath() for node in ctx.path.ant_glob("src/**/*.js")], _tty_out=False) # no tty because there are none in the cloudpebble sandbox. - except ErrorReturnCode_2 as e: - ctx.fatal("\nJavaScript linting failed (you can disable this in Project Settings):\n" + e.stdout) - - # Concatenate all our JS files (but not recursively), and only if any JS exists in the first place. - ctx.path.make_node('src/js/').mkdir() - js_paths = ctx.path.ant_glob(['src/*.js', 'src/**/*.js']) - if js_paths: - ctx(rule='cat ${SRC} > ${TGT}', source=js_paths, target='pebble-js-app.js') - has_js = True - else: - has_js = False +def build(ctx): ctx.load('pebble_sdk') build_worker = os.path.exists('worker_src') binaries = [] - for p in ctx.env.TARGET_PLATFORMS: - ctx.set_env(ctx.all_envs[p]) + cached_env = ctx.env + for platform in ctx.env.TARGET_PLATFORMS: + ctx.env = ctx.all_envs[platform] ctx.set_group(ctx.env.PLATFORM_NAME) - app_elf='{}/pebble-app.elf'.format(p) - ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c'), - target=app_elf) + app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR) + ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=app_elf, bin_type='app') if build_worker: - worker_elf='{}/pebble-worker.elf'.format(p) - binaries.append({'platform': p, 'app_elf': app_elf, 'worker_elf': worker_elf}) - ctx.pbl_worker(source=ctx.path.ant_glob('worker_src/**/*.c'), - target=worker_elf) + worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR) + binaries.append({'platform': platform, 'app_elf': app_elf, 'worker_elf': worker_elf}) + ctx.pbl_build(source=ctx.path.ant_glob('worker_src/c/**/*.c'), + target=worker_elf, + bin_type='worker') else: - binaries.append({'platform': p, 'app_elf': app_elf}) + binaries.append({'platform': platform, 'app_elf': app_elf}) + ctx.env = cached_env ctx.set_group('bundle') - ctx.pbl_bundle(binaries=binaries, js='pebble-js-app.js' if has_js else []) - \ No newline at end of file + ctx.pbl_bundle(binaries=binaries, + js=ctx.path.ant_glob(['src/pkjs/**/*.js', + 'src/pkjs/**/*.json', + 'src/common/**/*.js']), + js_entry_file='src/pkjs/index.js')