Skip to content

DAOS-18533 ddb: Fix ddb completion #21247

DAOS-18533 ddb: Fix ddb completion

DAOS-18533 ddb: Fix ddb completion #21247

Workflow file for this run

name: Linting
# Always run on Pull Requests as then these checks can be marked as required.
on:
push:
branches:
- master
- 'feature/*'
- 'release/*'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
jobs:
# Run isort on the tree.
# This checks .py files only so misses SConstruct and SConscript files are not checked, rather
# for these files check them afterwards. The output-filter will not be installed for this part
# so regressions will be detected but not annotated.
isort:
name: Python isort
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3'
- name: Install extra python packages
run: python3 -m pip install --requirement utils/cq/requirements.txt
- name: Run isort
uses: isort/isort-action@24d8a7a51d33ca7f36c3f23598dafa33f7071326 # v1.1.1
with:
requirementsFiles: "requirements.txt"
- name: Run on SConstruct file.
run: isort --check-only SConstruct
- name: Run on build files.
run: find . -name SConscript | xargs isort --check-only
shell-check:
name: ShellCheck
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run
run: sudo apt-get update && sudo apt-get install shellcheck
- name: Add error parser
run: echo -n "::add-matcher::ci/shellcheck-matcher.json"
- name: Run Shellcheck
# The check will run with this file from the target branch but the code from the PR so
# test for this file before calling it to prevent failures on PRs where this check is
# in the target branch but the PR is not updated to include it.
run: \[ ! -x ci/run_shellcheck.sh \] || ./ci/run_shellcheck.sh
log-check:
name: Logging macro checking
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check DAOS logging macro use.
run: ./utils/cq/d_logging_check.py --github src
ftest-tags:
name: Ftest tag check
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check DAOS ftest tags.
run: \[ ! -x src/tests/ftest/tags.py \] || ./src/tests/ftest/tags.py lint --verbose
flake8-lint:
runs-on: ubuntu-24.04
name: Flake8 check
steps:
- name: Check out source repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3'
- name: Add parser
run: echo -n "::add-matcher::ci/daos-flake-matcher.json"
- name: Add whitespace parser
run: echo -n "::add-matcher::ci/daos-flakew-matcher.json"
- name: Add error parser
run: echo -n "::add-matcher::ci/daos-flakee-matcher.json"
- name: flake8 Lint
uses: py-actions/flake8@84ec6726560b6d5bd68f2a5bed83d62b52bb50ba # v2.3.0
with:
# W503 and W504 are related as they conflict. W503 is the preferred style and all code
# should be using it now.
ignore: 'W503'
exclude: 'src/control/vendor,src/client/pydaos/raw'
max-line-length: '100'
- name: flake8 Lint on SCons files.
uses: py-actions/flake8@84ec6726560b6d5bd68f2a5bed83d62b52bb50ba # v2.3.0
with:
ignore: 'F821,W503,F841'
max-line-length: '100'
args: '--filename */SConscript, SConstruct'
doxygen:
name: Doxygen
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install doxygen
run: sudo apt-get install doxygen
- name: Add parser
run: echo -n "::add-matcher::ci/daos-doxygen-matcher.json"
- name: Run check
run: doxygen Doxyfile
- name: 'Upload Artifact'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: API Documentation
path: docs/doxygen/html/
retention-days: 1
pylint:
name: Pylint check
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- name: Install python packages
run: python3 -m pip install --requirement requirements.txt
- name: Install enchant
run: sudo apt-get update && sudo apt-get -y install python3-enchant
- name: Show versions
run: ./utils/cq/daos_pylint.py --version
- name: Run pylint check.
run: ./utils/cq/daos_pylint.py --git --output-format github
codespell:
name: Codespell
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install extra python packages
run: python3 -m pip install --requirement utils/cq/requirements.txt
- name: Run check
uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # master
with:
skip: ./src/control/vendor,./src/control/go.sum,./.git,./utils/*.patch
ignore_words_file: ci/codespell.ignores
builtin: clear,rare,informal,names,en-GB_to_en-US
clang-format:
name: Clang Format
runs-on: ubuntu-24.04
steps:
- name: Check out source repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Pull via git
run: git fetch origin ${{ github.event.pull_request.base.ref }}
- name: Get merge-base ref
id: get_merge_base
run: |
ref="$(git merge-base HEAD ${{ github.event.pull_request.base.sha || github.ref }})"
echo "ref=$ref" >> $GITHUB_OUTPUT
- name: Run check in docker
uses: ./.github/actions/clang-format
with:
target: ${{ steps.get_merge_base.outputs.ref }}
- name: Export changes
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: failure()
with:
name: format-patch-for-pr-${{ github.event.pull_request.number }}
path: auto-format-changes.diff
yaml-lint:
name: Yamllint check
runs-on: ubuntu-24.04
steps:
- name: Check out source repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3'
- name: Install extra python packages
run: python3 -m pip install --requirement utils/cq/requirements.txt
- name: Run check
run: yamllint --format github .
copyright:
name: Copyright check
runs-on: ubuntu-24.04
steps:
- name: Check out source repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Run check
run: |
\[ ! -x ./utils/cq/check_update_copyright.sh \] || ./utils/cq/check_update_copyright.sh \
$(git merge-base HEAD ${{ github.event.pull_request.base.sha || github.ref }}) gha
linting-summary:
name: Linting Summary
runs-on: ubuntu-24.04
needs:
- isort
- shell-check
- log-check
- ftest-tags
- flake8-lint
- doxygen
- pylint
- codespell
- clang-format
- yaml-lint
- copyright
if: (!cancelled())
steps:
- name: Check if any job failed
run: |
ALL_DEPS_RESULT='${{ toJSON(needs) }}'
echo "$ALL_DEPS_RESULT" | jq -rc 'keys[] as $k | "\($k):\(.[$k].result)"' \
| while read job_result; do
job_name=$(echo "$job_result" | cut -d: -f1)
job_result=$(echo "$job_result" | cut -d: -f2)
echo "$job_name = $job_result"
if [[ "$job_result" != "success" ]]; then
echo "Job $job_name failed"
exit 1
fi
done