actions: update daily version for testing
Update versions.json with the daily commit that device testing will be performed on. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
36c1866cfd
commit
b8c7de6d9a
2 changed files with 103 additions and 0 deletions
35
.github/workflows/daily_test_version.yml
vendored
Normal file
35
.github/workflows/daily_test_version.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Copyright (c) 2020 Intel Corp.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Publish commit for daily testing
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '50 22 * * *'
|
||||
push:
|
||||
branches:
|
||||
- refs/tags/*
|
||||
|
||||
jobs:
|
||||
get_version:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_TESTING }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_TESTING }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: install-pip
|
||||
run: |
|
||||
pip3 install gitpython
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Upload to AWS S3
|
||||
run: |
|
||||
python3 scripts/ci/version_mgr.py --update .
|
||||
aws s3 cp versions.json s3://testing.zephyrproject.org/daily_tests/versions.json
|
68
scripts/ci/version_mgr.py
Executable file
68
scripts/ci/version_mgr.py
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2020 Intel Corp.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import json
|
||||
import argparse
|
||||
import urllib.request
|
||||
|
||||
from git import Git
|
||||
|
||||
VERSIONS_FILE = "versions.json"
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Manage versions to be tested.")
|
||||
parser.add_argument('-l', '--list', action="store_true",
|
||||
help="List all published versions")
|
||||
parser.add_argument('-u', '--update',
|
||||
help="Update versions file from tree.")
|
||||
parser.add_argument('-L', '--latest', action="store_true",
|
||||
help="Get latest published version")
|
||||
return parser.parse_args()
|
||||
|
||||
def get_versions():
|
||||
data = None
|
||||
url = 'https://testing.zephyrproject.org/daily_tests/versions.json'
|
||||
urllib.request.urlretrieve(url, 'versions.json')
|
||||
with open("versions.json", "r") as fp:
|
||||
data = json.load(fp)
|
||||
|
||||
return data
|
||||
|
||||
def show_versions():
|
||||
data = get_versions()
|
||||
for v in data:
|
||||
print(f"- {v}")
|
||||
|
||||
def show_latest():
|
||||
data = get_versions()
|
||||
print(data[-1])
|
||||
|
||||
def update(git_tree):
|
||||
g = Git(git_tree)
|
||||
version = g.describe()
|
||||
published = False
|
||||
data = get_versions()
|
||||
if version in data:
|
||||
published = True
|
||||
print("version already published")
|
||||
else:
|
||||
print(f"New version {version}, adding to file...")
|
||||
|
||||
if data and not published:
|
||||
with open(VERSIONS_FILE, "w") as versions:
|
||||
data.append(version)
|
||||
json.dump(data, versions)
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
if args.update:
|
||||
update(args.update)
|
||||
elif args.list:
|
||||
show_versions()
|
||||
elif args.latest:
|
||||
show_latest()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue