sof/.github/workflows/codestyle.yml

70 lines
2.1 KiB
YAML

---
# SPDX-License-Identifier: BSD-3-Clause
# Tools that can save round-trips to github and a lot of time:
#
# yamllint -f parsable this.yml
# pip3 install ruamel.yaml.cmd
# yaml merge-expand this.yml exp.yml && diff -w -u this.yml exp.yml
#
# github.com also has a powerful web editor that can be used without
# committing.
name: codestyle
# yamllint disable-line rule:truthy
on: [pull_request, workflow_call, workflow_dispatch]
jobs:
checkpatch:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
strictness: [null, --subjective]
env:
PR_NUM: ${{github.event.number}}
# TODO: reduce duplication with scripts/sof-*-commit-hook.sh
# thanks to either some .conf file or some wrapper script
CHK_CMD_OPTS: --ignore UNKNOWN_COMMIT_ID --codespell
steps:
# depth 2 so:
# ^1. we can show the Subject of the current target branch tip
# ^2. we reconnect/graft to the later fetch pull/1234/head,
- uses: actions/checkout@v4
with: {fetch-depth: 2}
- name: install codespell
run: sudo apt-get -y install codespell && dpkg -L codespell | grep dict
# See shallowness issue https://github.com/thesofproject/linux/issues/2556
- name: fetch PR commits
run: |
.github/workflows/shallowfetchPRcommits.sh \
${GITHUB_REPOSITORY} "$PR_NUM"
# show what we got
git --no-pager log --oneline --graph --decorate --max-count=50
- name: checkpatch
env:
STRICTNESS: ${{ matrix.strictness }}
run: .github/workflows/checkpatch_list.sh ${CHK_CMD_OPTS}
${STRICTNESS} < PR_SHAs.txt
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
filter: 'tree:0'
- name: run yamllint
# Quoting to please all parsers is hard. This indirection helps.
env:
yamllint_config: '{extends: default, rules: {line-length: {max: 100}}}'
run: yamllint -f parsable
-d "$yamllint_config"
--strict .github/workflows/*.yml *.yml