summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 49ccabb629d917563dcf2fedb1b7fe343c79d477 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: CI Checks

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  git-secrets:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Checkout awslabs/git-secrets
        uses: actions/checkout@v2
        with:
          repository: awslabs/git-secrets
          ref: master
          path: git-secrets
      - name: Install git-secrets
        run: cd git-secrets && sudo make install && cd ..
      - name: Run git-secrets
        run: |
          git-secrets --register-aws
          git-secrets --scan

  formatting:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Uncrustify
        run: sudo apt-get install uncrustify
      - name: Run Uncrustify
        run: |
          uncrustify --version
          find FreeRTOS/Demo/Common FreeRTOS/Test \( -name ethernet -o -name drivers -o -path 'FreeRTOS/Test/CMock/CMock' \) -prune -false -o -name "*.[hc]" -exec uncrustify --check -c tools/uncrustify.cfg {} +
      - name: Check For Trailing Whitespace
        run: |
          set +e
          ERROR=0
          find .  \( -name '.git' -o -path "./FreeRTOS/Test/CBMC/patches" -o -path "./FreeRTOS-Plus" -o -path "./FreeRTOS/Source"  -o  -path "./FreeRTOS/Test/CMock/CMock"  -o -path "./FreeRTOS/Demo" \) -prune -false -o -type f -a -name "*" -exec grep  -In -e "[[:blank:]]$" {} +
          if [ "$?" = "0" ]; then
            echo "Files have trailing whitespace."
            ERROR=1
          fi

          find FreeRTOS/Demo/Common   \( -name "ethernet" \) -prune -o -false -o -type f -a -name "*" -exec grep --color=yes -In -e "[[:blank:]]$" {} +
          if [ "$?" = "0" ]; then
            echo "Files have trailing whitespace."
            exit 1
          else
            if [ "$ERROR" -eq "1" ]; then
              exit 1
            fi
            exit 0
          fi

  doxygen:
    runs-on: ubuntu-20.04
    steps:
      - name: Clone repository
        uses: actions/checkout@v2
        with:
          submodules: recursive
          path: freertos
      - name: Install Python3
        uses: actions/setup-python@v2
        with:
          python-version: '3.8'
      - name: Download tag dependency of coreMQTT-Agent
        run: |
          # We don't need to generate the coreMQTT docs, we only need the tag file.
          # Therefore, we can just download it.
          mkdir -p freertos/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent/source/dependency/coreMQTT/docs/doxygen/output
          wget -O freertos/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent/source/dependency/coreMQTT/docs/doxygen/output/mqtt.tag \
          "https://freertos.org/Documentation/api-ref/coreMQTT/docs/doxygen/output/mqtt.tag"
      - name: Generate doxygen ZIP
        uses: FreeRTOS/CI-CD-GitHub-Actions/doxygen@main
        with:
          path: ./freertos
          # List of directories containing libraries whose doxygen output will be generated.
          libs_parent_dir_path: FreeRTOS-Plus/Source,FreeRTOS-Plus/Source/AWS,FreeRTOS-Plus/Source/Application-Protocols,FreeRTOS-Plus/Source/Utilities
          generate_zip: true
      - name: Upload doxygen artifact if main branch
        if: success() && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release-candidate' )
        env:
          GIT_SHA:
        uses: actions/upload-artifact@v2
        with:
          name: doxygen.zip-${{ github.sha }}
          path: ./freertos/doxygen.zip
          retention-days: 2

  spell-check:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Parent Repo
        uses: actions/checkout@v2
        with:
          ref: main
          repository: FreeRTOS/CI-CD-Github-Actions
          path: commonCI
      - name: Clone This Repo
        uses: actions/checkout@v2
        with:
            path: ./FreeRTOS
      - name: Install spell
        run: |
          sudo apt-get install spell
          sudo apt-get install util-linux
      - name: Check spelling
        run: |
          # Add path to the tool to the environment variable.
          PATH=$PATH:commonCI/spellings/tools
          # Make sure that only Amazon licenced files are checked.
          sed -i 's/`find $DIRNAME \\( -iname \\\*\.\[ch\] -o -iname \\\*\.dox \\) -type f`/`grep -ril "copyright \(c\) \[0-9\]\[0-9\]\[0-9\]\[0-9\] amazon.com" | grep "\\.\[ch\]"`/g' commonCI/spellings/tools/find-unknown-comment-words
          # Run the spell check script.
          find-unknown-comment-words --directory FreeRTOS/ --lexicon FreeRTOS/lexicon.txt
          # Check the exit status.
          if [ "$?" = "0" ]; then
            exit 0
          else
            exit 1
          fi

  verify-manifest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Python3
        uses: actions/setup-python@v2
        with:
          python-version: '3.8'
      - name: Install dependencies
        run: python3 -m pip install -r .github/scripts/verify_manifest_requirements.txt
      - name: Run script to verify manifest.yml
        run: python3 .github/scripts/verify_manifest.py