feat: add a GitHub action to lint the YAML files

Lint some YAML
Add a `.yamllint` config file
This commit is contained in:
John Bampton 2020-12-15 11:01:37 +10:00 committed by Xiang Xiao
parent 32bf92c5c3
commit ca6b11b425
6 changed files with 68 additions and 48 deletions

View File

@ -15,8 +15,8 @@ github:
- microcontroller - microcontroller
enabled_merge_buttons: enabled_merge_buttons:
# disable squash button: # disable squash button:
squash: false squash: false
# disable merge button: # disable merge button:
merge: false merge: false
# enable rebase button: # enable rebase button:
rebase: true rebase: true

View File

@ -150,7 +150,7 @@ jobs:
command: docker pull docker.pkg.github.com/apache/incubator-nuttx-testing/nuttx-ci-linux command: docker pull docker.pkg.github.com/apache/incubator-nuttx-testing/nuttx-ci-linux
- name: Export NuttX Repo SHA - name: Export NuttX Repo SHA
run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
- name: Run builds - name: Run builds
uses: ./sources/testing/.github/actions/ci-container uses: ./sources/testing/.github/actions/ci-container
env: env:
@ -193,7 +193,7 @@ jobs:
key: ${{ runner.os }}-tools-${{ hashFiles('./sources/testing/cibuild.sh') }} key: ${{ runner.os }}-tools-${{ hashFiles('./sources/testing/cibuild.sh') }}
- name: Export NuttX Repo SHA - name: Export NuttX Repo SHA
run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
- name: Run Builds - name: Run Builds
run: | run: |
echo "::add-matcher::sources/nuttx/.github/gcc.json" echo "::add-matcher::sources/nuttx/.github/gcc.json"

View File

@ -22,18 +22,18 @@ jobs:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- name: Checkout nuttx repo - name: Checkout nuttx repo
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
repository: apache/incubator-nuttx repository: apache/incubator-nuttx
path: nuttx path: nuttx
fetch-depth: 0 fetch-depth: 0
- name: Check Pull Request - name: Check Pull Request
run: | run: |
echo "::add-matcher::nuttx/.github/nxstyle.json" echo "::add-matcher::nuttx/.github/nxstyle.json"
cd nuttx cd nuttx
commits="${{ github.event.pull_request.base.sha }}..HEAD" commits="${{ github.event.pull_request.base.sha }}..HEAD"
git log --oneline $commits git log --oneline $commits
echo "../nuttx/tools/checkpatch.sh -g $commits" echo "../nuttx/tools/checkpatch.sh -g $commits"
../nuttx/tools/checkpatch.sh -g $commits ../nuttx/tools/checkpatch.sh -g $commits

View File

@ -19,35 +19,35 @@ jobs:
build-html: build-html:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: '3.8' python-version: '3.8'
- name: Generate requirements.txt file - name: Generate requirements.txt file
run: | run: |
cd Documentation/ cd Documentation/
pip3 install pipenv pip3 install pipenv
pipenv lock -r > requirements.txt pipenv lock -r > requirements.txt
- uses: ammaraskar/sphinx-problem-matcher@master - uses: ammaraskar/sphinx-problem-matcher@master
- uses: ammaraskar/sphinx-action@master - uses: ammaraskar/sphinx-action@master
with: with:
docs-folder: "Documentation/" docs-folder: "Documentation/"
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: sphinx-docs name: sphinx-docs
path: Documentation/_build/html/ path: Documentation/_build/html/
linkcheck: linkcheck:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: '3.8' python-version: '3.8'
- uses: ammaraskar/sphinx-problem-matcher@master - uses: ammaraskar/sphinx-problem-matcher@master
- name: Run linkcheck - name: Run linkcheck
run: | run: |
cd Documentation/ cd Documentation/
pip3 install pipenv pip3 install pipenv
pipenv install pipenv install
# This step flakes frequently so still annotate errors but dont fail the build # This step flakes frequently so still annotate errors but dont fail the build
pipenv run make linkcheck || true pipenv run make linkcheck || true

12
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,12 @@
name: ❄️ Lint
on: [pull_request]
jobs:
yamllint:
name: 🍺 YAML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🧹 YAML Lint
uses: ibiqlik/action-yamllint@v3

8
.yamllint Normal file
View File

@ -0,0 +1,8 @@
---
extends: default
rules:
document-start: disable
line-length: disable
truthy: disable