|
| 1 | +# This workflow performs the checks like license check, |
| 2 | +# doxygen, unit tests etc. |
| 3 | + |
| 4 | +name: Basic Checks |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - mbed-os-5.15 |
| 11 | + |
| 12 | +jobs: |
| 13 | + |
| 14 | + license-check: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + container: |
| 17 | + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout repo |
| 21 | + uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - |
| 26 | + name: license check |
| 27 | + run: | |
| 28 | + set -x |
| 29 | + mkdir -p SCANCODE |
| 30 | + |
| 31 | + git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ |
| 32 | + | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) |
| 33 | + echo $? |
| 34 | + git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ |
| 35 | + | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \ |
| 36 | + | ( grep -v '^tools/test/toolchains/api_test.py' || true ) \ |
| 37 | + | while read file; do cp --parents "${file}" SCANCODE; done |
| 38 | + ls SCANCODE |
| 39 | + scancode -l --json-pp scancode.json SCANCODE |
| 40 | +
|
| 41 | + python ./tools/test/ci/scancode-evaluate.py scancode.json || true |
| 42 | + cat scancode-evaluate.log |
| 43 | + COUNT=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true |
| 44 | + if [ $COUNT = 0 ]; then |
| 45 | + echo "License check OK"; |
| 46 | + true; |
| 47 | + else |
| 48 | + echo "License check failed, please review license issues found in files"; |
| 49 | + false; |
| 50 | + fi |
| 51 | +
|
| 52 | + include-check: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + container: |
| 55 | + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Checkout repo |
| 59 | + uses: actions/checkout@v2 |
| 60 | + |
| 61 | + - |
| 62 | + name: "include check" |
| 63 | + run: | |
| 64 | + ! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \ |
| 65 | + ':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \ |
| 66 | + ':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' |
| 67 | +
|
| 68 | + docs-check: |
| 69 | + runs-on: ubuntu-latest |
| 70 | + container: |
| 71 | + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest |
| 72 | + |
| 73 | + steps: |
| 74 | + - name: Checkout repo |
| 75 | + uses: actions/checkout@v2 |
| 76 | + |
| 77 | + - |
| 78 | + name: spell checks |
| 79 | + run: | |
| 80 | + ./tools/test/ci/doxy-spellchecker/spell.sh drivers |
| 81 | + ./tools/test/ci/doxy-spellchecker/spell.sh platform |
| 82 | + ./tools/test/ci/doxy-spellchecker/spell.sh events |
| 83 | + ./tools/test/ci/doxy-spellchecker/spell.sh rtos |
| 84 | + ./tools/test/ci/doxy-spellchecker/spell.sh connectivity/netsocket |
| 85 | +
|
| 86 | + - |
| 87 | + name: doxygen |
| 88 | + run: | |
| 89 | + mkdir BUILD |
| 90 | + # Assert that the Doxygen build produced no warnings. |
| 91 | + # The strange command below asserts that the Doxygen command had an |
| 92 | + # output of zero length |
| 93 | + doxygen doxyfile_options 2>&1 |
| 94 | + # Once Mbed OS has been fixed, enable the full test by replacing the top line with this: |
| 95 | + # - ( ! doxygen doxyfile_options 2>&1 | grep . ) |
| 96 | + # Assert that all binary libraries are named correctly |
| 97 | + # The strange command below asserts that there are exactly 0 libraries |
| 98 | + # that do not start with lib |
| 99 | + find "(" -name "*.a" -or -name "*.ar" ")" -and -not -name "lib*" | |
| 100 | + tee BUILD/badlibs | |
| 101 | + sed -e "s/^/Bad library name found: /" && [ ! -s BUILD/badlibs ] |
| 102 | + # Assert that all assembler files are named correctly |
| 103 | + # The strange command below asserts that there are exactly 0 libraries |
| 104 | + # that do end with .s |
| 105 | + find -name "*.s" | tee BUILD/badasm | |
| 106 | + sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ] |
| 107 | + |
| 108 | + |
| 109 | + style-check: |
| 110 | + runs-on: ubuntu-latest |
| 111 | + container: |
| 112 | + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest |
| 113 | + |
| 114 | + steps: |
| 115 | + - name: Checkout repo |
| 116 | + uses: actions/checkout@v2 |
| 117 | + with: |
| 118 | + fetch-depth: 0 |
| 119 | + |
| 120 | + - |
| 121 | + name: astyle checks |
| 122 | + run: | |
| 123 | + git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ |
| 124 | + | ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \ |
| 125 | + | ( grep -v -f .astyleignore || true ) \ |
| 126 | + | while read file; do astyle -n --options=.astylerc "${file}"; done |
| 127 | + git diff --exit-code --diff-filter=d --color |
| 128 | +
|
| 129 | + - |
| 130 | + name: "UTF-8 Check" |
| 131 | + run: | |
| 132 | + # Make sure we're not introducing any text which is not UTF-8 encoded |
| 133 | + git diff origin/${GITHUB_BASE_REF} -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' ) |
| 134 | +
|
| 135 | +
|
| 136 | + python-tests: |
| 137 | + # these tests run in 3.7, hence running in vm not in pre-built docker |
| 138 | + runs-on: ubuntu-latest |
| 139 | + strategy: |
| 140 | + matrix: |
| 141 | + python-version: [ '3.5', '3.6', '3.7' ] |
| 142 | + |
| 143 | + steps: |
| 144 | + - |
| 145 | + name: Checkout repo |
| 146 | + uses: actions/checkout@v2 |
| 147 | + |
| 148 | + |
| 149 | + - uses: actions/setup-python@v2 |
| 150 | + with: |
| 151 | + python-version: ${{ matrix.python-version }} |
| 152 | + |
| 153 | + - |
| 154 | + name: install dependencies |
| 155 | + run: | |
| 156 | + pip install -r requirements.txt |
| 157 | + pip install mock==2.0.0 attrs==19.1.0 pytest==3.3.0 'pylint>=1.9,<2' 'hypothesis>=3,<4' 'coverage>=4.5,<5' |
| 158 | + - |
| 159 | + name: pytest |
| 160 | + run: | |
| 161 | + # PYTHONPATH=. |
| 162 | + coverage run -a -m pytest tools/test |
| 163 | + python tools/test/pylint.py |
| 164 | + coverage run -a tools/project.py -S | sed -n '/^Total/p' |
| 165 | + coverage html |
| 166 | +
|
| 167 | + events-library: |
| 168 | + runs-on: ubuntu-latest |
| 169 | + container: |
| 170 | + image: ghcr.io/armmbed/mbed-os-env:mbed-os-5.15-latest |
| 171 | + |
| 172 | + steps: |
| 173 | + |
| 174 | + - |
| 175 | + name: Checkout repo |
| 176 | + uses: actions/checkout@v2 |
| 177 | + with: |
| 178 | + fetch-depth: 0 |
| 179 | + |
| 180 | + - |
| 181 | + name: run test |
| 182 | + shell: bash |
| 183 | + run: | |
| 184 | + # Check that example compiles |
| 185 | + sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' events/README.md > main.cpp |
| 186 | + python tools/make.py -t GCC_ARM -m K64F --source=. --build=BUILD/K64F/GCC_ARM -j0 |
| 187 | + # Check that example compiles without rtos |
| 188 | + sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' events/README.md > main.cpp |
| 189 | + rm -r rtos drivers/source/usb features/cellular features/netsocket features/nanostack \ |
| 190 | + features/lwipstack features/frameworks/greentea-client \ |
| 191 | + features/frameworks/utest features/frameworks/unity components BUILD |
| 192 | + python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0 |
| 193 | + # Run local equeue tests |
| 194 | + make -C events/source test |
| 195 | + # Run profiling tests |
| 196 | + make -C events/source prof | tee prof |
0 commit comments