Skip to content

Commit

Permalink
[Telink] Add update Telink Zephyr to specific revision
Browse files Browse the repository at this point in the history
  • Loading branch information
s07641069 committed Oct 27, 2023
1 parent 50d4073 commit f450d65
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ jobs:
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: telink
- name: Update Zephyr to specific revision (for developers purpose)
shell: bash
run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 4b9be6d6a80690ca3fcc16421795e084f7d940ed"
- name: CI Examples Telink
shell: bash
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
with:
gh-context: ${{ toJson(github) }}

- name: Update Zephyr to specific revision (for developers purpose)
run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 4b9be6d6a80690ca3fcc16421795e084f7d940ed"

- name: Build example Telink (B92 retention) Air Quality Sensor App
run: |
./scripts/run_in_build_env.sh \
Expand Down
55 changes: 55 additions & 0 deletions scripts/tools/telink/update_zephyr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python3

#
# Copyright (c) 2023 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import argparse
import os
import subprocess
import sys

def main():

try:
zephyr_base = os.getenv("ZEPHYR_BASE")
if not zephyr_base:
zephyr_base = os.getenv("TELINK_ZEPHYR_BASE")
os.environ['ZEPHYR_BASE'] = zephyr_base
if not zephyr_base:
raise RuntimeError(
"No ZEPHYR_BASE environment variable found, please set ZEPHYR_BASE to a zephyr repository path.")

parser = argparse.ArgumentParser(
description='Script helping to update Telink Zephyr to specific revision.')
parser.add_argument("hash", help="Update Telink Zephyr to specific revision.")

args = parser.parse_args()

command = ['git', '-C', zephyr_base, 'reset', args.hash, '--hard']
subprocess.run(command, check=True)

command = ['west', 'update', '-o=--depth=1', '-n', '-f', 'smart']
subprocess.run(command, check=True)

command = ['west', 'blobs', 'fetch', 'hal_telink']
subprocess.run(command, check=True)

except (RuntimeError, subprocess.CalledProcessError) as e:
print(e)
sys.exit(1)

if __name__ == '__main__':
main()

0 comments on commit f450d65

Please sign in to comment.