Skip to content

Commit 091aef1

Browse files
author
Qinghao Shi
authored
Merge pull request #77 from jamesbeyond/repo_check
add ci files for check the repo structure
2 parents e370241 + 985c2e8 commit 091aef1

File tree

5 files changed

+252
-171
lines changed

5 files changed

+252
-171
lines changed

.circleci/config.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ jobs:
77
build:
88
docker:
99
- image: mbedos/mbed-os-env:stable
10-
working_directory: ~/repo
1110
steps:
1211
- checkout:
13-
path: work/sinppet/TESTS
14-
- run: mv work/sinppet/TESTS/mbed-os.lib work/
15-
- run: git clone https://github.com/ARMmbed/mbed-os.git work/mbed-os
12+
path: sinppet/TESTS
13+
- run: |
14+
cd sinppet/TESTS
15+
python3 .circleci/repo_checks.py
16+
- run: mv sinppet/TESTS/mbed-os.lib .
17+
- run: git clone https://github.com/ARMmbed/mbed-os.git mbed-os
1618
- run: |
17-
cd work
1819
mbed config root .
1920
mbed update
2021
mbed add https://github.com/c1728p9/AudioPlayer

.circleci/repo_checks.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"""
2+
Copyright (c) 2016-2020 ARM Limited. All rights reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations
17+
"""
18+
19+
from pathlib import Path
20+
import glob
21+
import os.path
22+
import sys
23+
24+
level2_set= set()
25+
dup_set = set()
26+
27+
28+
def main():
29+
for filepath in Path('.').rglob('main.cpp'):
30+
level2dir=os.path.basename(os.path.dirname(filepath))
31+
level1dir=os.path.basename(os.path.dirname(os.path.dirname(filepath)))
32+
level0dir=os.path.dirname(os.path.dirname(os.path.dirname(filepath)))
33+
34+
# check if length of folder name less then 34
35+
if len(level2dir) > 34 :
36+
sys.stderr.write("ERROR: Snippet '{}' length of {} is {} exceed the requirement of 34".format(filepath,level2dir,len(level2dir)))
37+
sys.exit(1)
38+
39+
# check if folder level less than 2
40+
if level1dir == '':
41+
sys.stderr.write("ERROR: Snippet '{}' has only one level of folder, but 2 is required".format(filepath))
42+
sys.exit(1)
43+
44+
# check if folder level more than 2
45+
if level0dir != '':
46+
sys.stderr.write("ERROR: Snippet '{}' has more than two level of folders, but 2 is required".format(filepath))
47+
sys.exit(1)
48+
49+
if level2dir not in level2_set:
50+
level2_set.add(level2dir)
51+
else:
52+
dup_set.add(level2dir)
53+
54+
# check duplicated level2 folder names
55+
if len(dup_set) > 0 :
56+
for filepath in Path('.').rglob('main.cpp'):
57+
level2dir=os.path.basename(os.path.dirname(filepath))
58+
if level2dir in dup_set:
59+
sys.stderr.write("ERROR level2 name '{}' in path '{}' is has a duplicated with others".format(level2dir,filepath))
60+
sys.exit(1)
61+
62+
63+
print("All checks PASSED")
64+
65+
66+
if __name__ == "__main__":
67+
main()
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
## USBMIDI "Take Me Out to the Ball Game" example
2-
3-
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.
4-
5-
1. Flash the board, and ensure the target's auxiliary USB is plugged into the PC.
6-
2. Open Anvil Studio.
7-
3. Click View > Synthesizers, MIDI + Audio Devices.
8-
4. Uncheck Synth is too slow to echo incoming events.
9-
5. Click View > Composer (Staff Editor) to see notes from the board being mapped to the sheet music.
1+
## USBMIDI "Take Me Out to the Ball Game" example
2+
3+
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.
4+
5+
1. Flash the board, and ensure the target's auxiliary USB is plugged into the PC.
6+
2. Open Anvil Studio.
7+
3. Click View > Synthesizers, MIDI + Audio Devices.
8+
4. Uncheck Synth is too slow to echo incoming events.
9+
5. Click View > Composer (Staff Editor) to see notes from the board being mapped to the sheet music.

0 commit comments

Comments
 (0)