Skip to content

add ci files for check the repo structure #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ jobs:
build:
docker:
- image: mbedos/mbed-os-env:stable
working_directory: ~/repo
steps:
- checkout:
path: work/sinppet/TESTS
- run: mv work/sinppet/TESTS/mbed-os.lib work/
- run: git clone https://github.com/ARMmbed/mbed-os.git work/mbed-os
path: sinppet/TESTS
- run: |
cd sinppet/TESTS
python3 .circleci/repo_checks.py
- run: mv sinppet/TESTS/mbed-os.lib .
- run: git clone https://github.com/ARMmbed/mbed-os.git mbed-os
- run: |
cd work
mbed config root .
mbed update
mbed add https://github.com/c1728p9/AudioPlayer
Expand Down
67 changes: 67 additions & 0 deletions .circleci/repo_checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""
Copyright (c) 2016-2020 ARM Limited. All rights reserved.

SPDX-License-Identifier: Apache-2.0

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
"""

from pathlib import Path
import glob
import os.path
import sys

level2_set= set()
dup_set = set()


def main():
for filepath in Path('.').rglob('main.cpp'):
level2dir=os.path.basename(os.path.dirname(filepath))
level1dir=os.path.basename(os.path.dirname(os.path.dirname(filepath)))
level0dir=os.path.dirname(os.path.dirname(os.path.dirname(filepath)))

# check if length of folder name less then 34
if len(level2dir) > 34 :
sys.stderr.write("ERROR: Snippet '{}' length of {} is {} exceed the requirement of 34".format(filepath,level2dir,len(level2dir)))
sys.exit(1)

# check if folder level less than 2
if level1dir == '':
sys.stderr.write("ERROR: Snippet '{}' has only one level of folder, but 2 is required".format(filepath))
sys.exit(1)

# check if folder level more than 2
if level0dir != '':
sys.stderr.write("ERROR: Snippet '{}' has more than two level of folders, but 2 is required".format(filepath))
sys.exit(1)

if level2dir not in level2_set:
level2_set.add(level2dir)
else:
dup_set.add(level2dir)

# check duplicated level2 folder names
if len(dup_set) > 0 :
for filepath in Path('.').rglob('main.cpp'):
level2dir=os.path.basename(os.path.dirname(filepath))
if level2dir in dup_set:
sys.stderr.write("ERROR level2 name '{}' in path '{}' is has a duplicated with others".format(level2dir,filepath))
sys.exit(1)


print("All checks PASSED")


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## USBMIDI "Take Me Out to the Ball Game" example
The example plays an entire song, not just a series of notes. "Take Me Out to the Ball Game" is a popular song in the public domain.
1. Flash the board, and ensure the target's auxiliary USB is plugged into the PC.
2. Open Anvil Studio.
3. Click View > Synthesizers, MIDI + Audio Devices.
4. Uncheck Synth is too slow to echo incoming events.
5. Click View > Composer (Staff Editor) to see notes from the board being mapped to the sheet music.
## USBMIDI "Take Me Out to the Ball Game" example

The example plays an entire song, not just a series of notes. "Take Me Out to the Ball Game" is a popular song in the public domain.

1. Flash the board, and ensure the target's auxiliary USB is plugged into the PC.
2. Open Anvil Studio.
3. Click View > Synthesizers, MIDI + Audio Devices.
4. Uncheck Synth is too slow to echo incoming events.
5. Click View > Composer (Staff Editor) to see notes from the board being mapped to the sheet music.
Loading