-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
language: python | ||
python: | ||
- "2.7" | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- "~/.platformio" | ||
|
||
env: | ||
- PLATFORMIO_CI_SRC=src/main.cpp | ||
|
||
install: | ||
- pip install -U platformio | ||
|
||
script: | ||
- python deploy.py | ||
|
||
deploy: | ||
provider: releases | ||
api_key: | ||
secure: $GITHUB_OAUTH_TOKEN | ||
file_glob: true | ||
file: pipersense_*.zip | ||
skip_cleanup: true | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
import shutil | ||
from glob import glob | ||
|
||
# Set platfomio envirnoments to build | ||
envs = ["nodemcuv2"] | ||
|
||
# Get version of firmware from travis tag, otherwise set test-build | ||
version = os.getenv("TRAVIS_TAG", "test-build") | ||
|
||
# Iterate to generate firmware files and remove not needed ones | ||
for env in envs: | ||
# Iterate to generate firmware files | ||
os.system("platformio run -e %s -t buildfs" % env) | ||
os.system("platformio run -e %s" % env) | ||
|
||
# Remove not needed files | ||
shutil.rmtree(os.path.abspath(os.path.join(".pioenvs", env, "FrameworkArduino"))) | ||
shutil.rmtree(os.path.abspath(os.path.join(".pioenvs", env, "src"))) | ||
os.remove(os.path.abspath(os.path.join(".pioenvs", env, "libFrameworkArduino.a"))) | ||
os.remove(os.path.abspath(os.path.join(".pioenvs", env, "libFrameworkArduinoVariant.a"))) | ||
|
||
for lib in glob(os.path.abspath(os.path.join(".pioenvs", env, "lib*"))): | ||
shutil.rmtree(os.path.abspath(os.path.join(".pioenvs", env, lib))) | ||
|
||
# Check built files exist, otherwise raise | ||
if (os.path.exists(os.path.abspath(os.path.join(".pioenvs", env, "firmware.bin"))) and | ||
os.path.exists(os.path.abspath(os.path.join(".pioenvs", env, "firmware.elf"))) and | ||
os.path.exists(os.path.abspath(os.path.join(".pioenvs", env, "spiffs.bin")))): | ||
print ("OK [%s]: All files created" % env) | ||
else: | ||
raise Exception("ERROR [%s]: Missing files" % env) | ||
|
||
# Remove not needed external files | ||
for element in glob(os.path.abspath(os.path.join(".pioenvs", "*"))): | ||
if os.path.isfile(element): | ||
os.remove(element) | ||
|
||
# Create zip with firmware files for each platformio environment | ||
shutil.make_archive(os.path.abspath("pipersense_%s" % version), | ||
'zip', | ||
os.path.abspath(os.path.join(".", ".pioenvs"))) |