1name: Kernel-Checker 2 3on: [push, pull_request] 4 5jobs: 6 kernel-checker: 7 name: FreeRTOS Kernel Header Checks 8 runs-on: ubuntu-20.04 9 steps: 10 # Install python 3 11 - name: Tool Setup 12 uses: actions/setup-python@v3 13 env: 14 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 16 # There is shared code, hosted by FreeRTOS/FreeRTOS, with deps needed by header checker 17 - name: Checkout FreeRTOS Tools 18 uses: actions/checkout@v4.1.1 19 with: 20 repository: FreeRTOS/FreeRTOS 21 sparse-checkout: '.github' 22 ref: main 23 path: tools 24 25 # Checkout user pull request changes 26 - name: Checkout Pull Request 27 uses: actions/checkout@v4.1.1 28 with: 29 path: inspect 30 31 # Collect all affected files 32 - name: Collecting changed files 33 uses: lots0logs/gh-action-get-changed-files@2.2.2 34 with: 35 token: ${{ secrets.GITHUB_TOKEN }} 36 37 # Run checks 38 - env: 39 bashPass: \033[32;1mPASSED - 40 bashInfo: \033[33;1mINFO - 41 bashFail: \033[31;1mFAILED - 42 bashEnd: \033[0m 43 stepName: Check File Headers 44 name: ${{ env.stepName }} 45 shell: bash 46 run: | 47 # ${{ env.stepName }} 48 echo -e "::group::${{ env.bashInfo }} Install Dependencies ${{ env.bashEnd }}" 49 50 # Copy the common tools from the FreeRTOS/FreeRTOS repo. 51 mv tools/.github/scripts/common inspect/.github/scripts 52 53 # Install the necessary python dependencies 54 pip install -r inspect/.github/scripts/common/requirements.txt 55 cd inspect 56 57 echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 58 59 # Use the python script to check the copyright header of modified files. 60 .github/scripts/kernel_checker.py --json ${HOME}/files_modified.json ${HOME}/files_added.json ${HOME}/files_renamed.json 61 exitStatus=$? 62 echo -e "::endgroup::" 63 64 if [ $exitStatus -eq 0 ]; then 65 echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 66 else 67 echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" 68 fi 69 exit $exitStatus 70