Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
checkpatch_extraignores:
type: string
default: ""
defconfigs:
required: false
type: string
default: ""
outputs:
fatal:
value: ${{ jobs.checks.outputs.fatal}}
Expand Down Expand Up @@ -74,15 +78,30 @@ jobs:
[ $status -eq 124 ] && echo "step_fail_coccicheck_timeout=true" >> "$GITHUB_ENV"
exit $status

- name: Check defconfigs
- name: Configure buildman toolchains
if: ${{ !cancelled() && env.fatal != 'true' }}
run: |
arm_gcc=$(basename "$(find /opt/gcc/armv7-eabihf/bin -maxdepth 1 -name '*gcc' | head -n 1)")
aarch64_gcc=$(basename "$(find /opt/gcc/aarch64/bin -maxdepth 1 -name '*gcc' | head -n 1)")

arm_prefix="/opt/gcc/armv7-eabihf/bin/${arm_gcc%gcc}"
aarch64_prefix="/opt/gcc/aarch64/bin/${aarch64_gcc%gcc}"

cat > "$HOME/.buildman" <<EOF
[toolchain-prefix]
arm = $arm_prefix
aarch64 = $aarch64_prefix
EOF

- name: Check qconfig
if: ${{ !cancelled() && env.fatal != 'true' }}
run: |
# Collect all defconfigs mentioned in the top-level and look for changes
configs=($(awk '/ARCH:/{arch=$2} /DEFCONFIG:/{print arch "/" $2}' \
.github/workflows/top-level.yml | \
sed 's/"//g'))
source ./ci/build.sh
check_assert_defconfigs ${configs[@]}
list=$(mktemp)
cat > "$list" <<'EOF'
${{ inputs.defconfigs }}
EOF
check_qconfig "$list"

- name: Export labels
if: ${{ !cancelled() }}
Expand Down
67 changes: 38 additions & 29 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,40 +275,49 @@ check_license() {
return $fail
}

check_assert_defconfigs() {
export step_name="check_assert_defconfigs"
check_qconfig() {
export step_name="check_qconfig"
local fail=0
local arch
local defconfig
local file
local list="$1"
local out
local changed=0
local message="
Verify if the changes are coherent, for example, the changes were not
caused by a mistakenly set Kconfig, and if so, run 'make savedefconfig',
overwrite the defconfig and commit it.
Verify if the Kconfig/defconfig state is coherent for the selected CI defconfigs.
If qconfig.py updates files, run it locally for the affected configs,
inspect the result, and commit the necessary changes.
"

echo "$step_name"
for arg in "$@"; do
arch=$(cut -d "/" -f1 <<< "$arg")
[[ "$arch" == "arm64" ]] && arch_=aarch64 || arch_=$arch
defconfig=$(cut -d "/" -f2 <<< "$arg")
file=arch/$arch/configs/$defconfig

if [[ -f $file ]]; then
echo $file
set_arch gcc_$arch_ 1>/dev/null
make $defconfig savedefconfig 1>/dev/null
rm .config

mv defconfig $file
out=$(git diff $_color --exit-code $file) || {
_fmt "::error file=$file::$step_name: Defconfig '$file' changed. $message
$out"
fail=1
}
git restore $file
fi
done

python3 tools/qconfig.py -s -d "$list"

out=$(git diff $_color --name-only)
if [[ -n "$out" ]]; then
while read -r file; do
[[ -z "$file" ]] && continue
_fmt "::error file=$(_file "$file")::$step_name: qconfig.py modified this file. $message"
changed=1
done <<< "$out"
fail=1
fi

out=$(git ls-files --others --exclude-standard)
if [[ -n "$out" ]]; then
while read -r file; do
[[ -z "$file" ]] && continue
[[ "$file" == "qconfig.failed" ]] && continue
[[ "$file" == "ci/build.sh" ]] && continue
[[ "$file" == "ci/runner_env.sh" ]] && continue
_fmt "::error file=$(_file "$file")::$step_name: qconfig.py created this untracked file. $message"
changed=1
done <<< "$out"
[[ "$changed" == "1" ]] && fail=1
fi

[[ "$changed" == "0" ]] && echo "qconfig.py produced no tree changes"

git restore .
git clean -fd -e ci/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So qconfig.py has a few options.
You are calling with -d a file containing a list of defconfigs to move and -s force sync by savedefconfig.
There is also a --test option for unit tests but

 """Run doctests and unit tests (so far there are no unit tests)"""

:)

return $fail
}
Expand Down