summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/build_board_info.py13
-rwxr-xr-xtools/build_release_files.py34
-rw-r--r--tools/ci_new_boards_check.py50
-rw-r--r--tools/gen_display_resources.py6
-rw-r--r--tools/travis_new_boards_check.py51
-rwxr-xr-xtools/upload_release_files.py32
6 files changed, 99 insertions, 87 deletions
diff --git a/tools/build_board_info.py b/tools/build_board_info.py
index 8731a6feb..f2b336494 100644
--- a/tools/build_board_info.py
+++ b/tools/build_board_info.py
@@ -88,10 +88,8 @@ def get_version_info():
# No exact match
pass
- if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
- sha = os.environ["TRAVIS_COMMIT"]
- if os.environ["TRAVIS_PULL_REQUEST"] != "false":
- sha = os.environ["TRAVIS_PULL_REQUEST_SHA"]
+ if "GITHUB_SHA" in os.environ:
+ sha = os.environ["GITHUB_SHA"]
if not version:
version="{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7])
@@ -132,7 +130,7 @@ def create_pr(changes, updated, git_info):
updated_list.append(info)
updated = json.dumps(updated_list, sort_keys=True, indent=4).encode("utf-8") + b"\n"
- print(updated.decode("utf-8"))
+ #print(updated.decode("utf-8"))
pr_title = "Automated website update for release {}".format(changes["new_release"])
boards = ""
if changes["new_boards"]:
@@ -208,7 +206,7 @@ def generate_download_info():
boards = {}
errors = []
- new_tag = os.environ["TRAVIS_TAG"]
+ new_tag = os.environ["RELEASE_TAG"]
changes = {
"new_release": new_tag,
@@ -240,7 +238,6 @@ def generate_download_info():
board_mapping = get_board_mapping()
- print(previous_releases)
for release in previous_releases:
update_downloads(board_mapping, release)
@@ -280,7 +277,7 @@ def generate_download_info():
print("No new release to update")
if __name__ == "__main__":
- if "TRAVIS_TAG" in os.environ and os.environ["TRAVIS_TAG"]:
+ if "RELEASE_TAG" in os.environ and os.environ["RELEASE_TAG"]:
generate_download_info()
else:
print("skipping website update because this isn't a tag")
diff --git a/tools/build_release_files.py b/tools/build_release_files.py
index e29b098c7..09133e51f 100755
--- a/tools/build_release_files.py
+++ b/tools/build_release_files.py
@@ -10,21 +10,14 @@ import time
for port in build_info.SUPPORTED_PORTS:
result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True)
-ROSIE_SETUPS = ["rosie-ci"]
-rosie_ok = {}
-for rosie in ROSIE_SETUPS:
- rosie_ok[rosie] = True
-
PARALLEL = "-j 5"
-travis = False
-if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
+if "GITHUB_ACTION" in os.environ:
PARALLEL="-j 2"
- travis = True
all_boards = build_info.get_board_mapping()
build_boards = list(all_boards.keys())
-if "TRAVIS_BOARDS" in os.environ:
- build_boards = os.environ["TRAVIS_BOARDS"].split()
+if "BOARDS" in os.environ:
+ build_boards = os.environ["BOARDS"].split()
sha, version = build_info.get_version_info()
@@ -83,25 +76,14 @@ for board in build_boards:
if exit_status == 0:
exit_status = 1
- if travis:
- print('travis_fold:start:adafruit-bins-{}-{}\\r'.format(language, board))
print("Build {board} for {language}{clean_build} took {build_duration:.2f}s and {success}".format(
board=board, language=language, clean_build=(" (clean_build)" if clean_build else ""),
build_duration=build_duration, success=success))
- if make_result.returncode != 0:
- print(make_result.stdout.decode("utf-8"))
- print(other_output)
- # Only upload to Rosie if its a pull request.
- if travis:
- for rosie in ROSIE_SETUPS:
- if not rosie_ok[rosie]:
- break
- print("Uploading to https://{rosie}.ngrok.io/upload/{sha}".format(rosie=rosie, sha=sha))
- #curl -F "file=@$final_filename" https://$rosie.ngrok.io/upload/$sha
- if travis:
- print('travis_fold:end:adafruit-bins-{}-{}\\r'.format(language, board))
-
- # Flush so travis will see something before 10 minutes has passed.
+
+ print(make_result.stdout.decode("utf-8"))
+ print(other_output)
+
+ # Flush so we will see something before 10 minutes has passed.
print(flush=True)
sys.exit(exit_status)
diff --git a/tools/ci_new_boards_check.py b/tools/ci_new_boards_check.py
new file mode 100644
index 000000000..7ad8af842
--- /dev/null
+++ b/tools/ci_new_boards_check.py
@@ -0,0 +1,50 @@
+#! /usr/bin/env python3
+
+import sys
+import os
+import json
+import yaml
+
+import build_board_info
+
+workflow_file = '.github/workflows/build.yml'
+
+# Get boards in json format
+boards_info_json = build_board_info.get_board_mapping()
+
+# Get all the boards out of the json format
+info_boards = [board for board in boards_info_json.keys() if not boards_info_json[board].get("alias", False)]
+
+# We need to know the path of the workflow file
+base_path = os.path.dirname(__file__)
+yml_path = os.path.abspath(os.path.join(base_path, '..', workflow_file))
+
+# Loading board list based on build jobs in the workflow file.
+ci_boards = []
+with open(yml_path, "r") as f:
+ workflow = yaml.safe_load(f)
+
+ok = True
+for job in workflow["jobs"]:
+ if not job.startswith("build"):
+ continue
+ job_boards = workflow["jobs"][job]["strategy"]["matrix"]["board"]
+ if job_boards != sorted(job_boards):
+ print("Boards for job \"{}\" not sorted. Must be:".format(job))
+ print(" - \"" + "\"\n - \"".join(sorted(job_boards)) + "\"")
+ ok = False
+ ci_boards.extend(job_boards)
+
+# All the travis_boards elements must be on info_boards
+info_boards.sort()
+ci_boards.sort()
+
+missing_boards = set(info_boards) - set(ci_boards)
+
+if missing_boards:
+ print('Boards missing in {}:'.format(workflow_file))
+ for board in missing_boards:
+ print(board)
+
+if not ok:
+ sys.exit(1)
diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py
index 0f6b9014b..65600a195 100644
--- a/tools/gen_display_resources.py
+++ b/tools/gen_display_resources.py
@@ -102,12 +102,14 @@ _displayio_color_t terminal_colors[2] = {
{
.rgb888 = 0x000000,
.rgb565 = 0x0000,
- .luma = 0x00
+ .luma = 0x00,
+ .chroma = 0
},
{
.rgb888 = 0xffffff,
.rgb565 = 0xffff,
- .luma = 0xff
+ .luma = 0xff,
+ .chroma = 0
},
};
diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py
deleted file mode 100644
index 5ae05aec4..000000000
--- a/tools/travis_new_boards_check.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#! /usr/bin/env python3
-
-import sys
-import os
-import json
-
-import build_board_info
-
-# Get boards in json format
-boards_info_json = build_board_info.get_board_mapping()
-
-# Get all the boards out of the json format
-info_boards = [board for board in boards_info_json.keys() if not boards_info_json[board].get("alias", False)]
-
-# We need to know the path of the .travis.yml file
-base_path = os.path.dirname(__file__)
-travis_path = os.path.abspath(os.path.join(base_path, '..', '.travis.yml'))
-
-# Loading board list based on TRAVIS_BOARDS env variable on .travis.yml
-travis_boards = []
-with open(travis_path, 'r') as travis:
-
- # Get all lines that contain the substring 'TRAVIS_BOARDS'
- for line in travis:
-
- # Get the lines with TRAVIS_BOARDS= in it
- if line.find('TRAVIS_BOARDS=') is not -1:
- # Store all the boards names into travis_boards
- begin_of_names = line.find('TRAVIS_BOARDS=') + len('TRAVIS_BOARDS=') + 1
- end_of_names = line.rfind('"')
- boards = line[begin_of_names:end_of_names]
- boards = boards.split(' ')
- travis_boards.extend(boards)
-
- # We've reached the end of the env: section
- elif 'addons' in line:
- break
- else:
- pass
-
-# All the travis_boards elements must be on info_boards
-info_boards.sort()
-travis_boards.sort()
-
-missing_boards = set(info_boards) - set(travis_boards)
-
-if missing_boards:
- print('Boards missing in TRAVIS_BOARDS:')
- for board in missing_boards:
- print(board)
- sys.exit(1)
diff --git a/tools/upload_release_files.py b/tools/upload_release_files.py
new file mode 100755
index 000000000..6c842dc68
--- /dev/null
+++ b/tools/upload_release_files.py
@@ -0,0 +1,32 @@
+#! /usr/bin/env python3
+
+import os
+import os.path
+import sys
+import uritemplate
+
+sys.path.append("adabot")
+import adabot.github_requests as github
+
+exit_status = 0
+
+for dirpath, dirnames, filenames in os.walk("../bin"):
+ if not filenames:
+ continue
+ for filename in filenames:
+ full_filename = os.path.join(dirpath, filename)
+ label = filename.replace("adafruit-circuitpython-", "")
+ url_vars = {}
+ url_vars["name"] = filename
+ url_vars["label"] = label
+ url = uritemplate.expand(os.environ["UPLOAD_URL"], url_vars)
+ headers = {"content-type": "application/octet-stream"}
+ print(url)
+ with open(full_filename, "rb") as f:
+ response = github.post(url, data=f, headers=headers)
+ if not response.ok:
+ print("Upload of {} failed with {}.".format(filename, response.status_code))
+ print(response.text)
+ sys.exit(response.status_code)
+
+sys.exit(exit_status)