Skip to content

Commit

Permalink
(#15500) linter workflow: fix linter change test on test_package
Browse files Browse the repository at this point in the history
* linter workflow: randomize the test of linter changes

* do a single pylint call for all tests

this should fix the error message counting

* sort messages by order of occurance

* Update linter-conan-v2.yml

* test 500 recipes

take advantage of the faster execution time

* post result as message on PR

* fixup

* Update linter-conan-v2.yml

* Update linter-conan-v2.yml

* Update linter-conan-v2.yml

* Remove message posting

There is a permissions issue
  • Loading branch information
ericLemanissier authored Feb 1, 2023
1 parent 3241184 commit 448983c
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions .github/workflows/linter-conan-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,18 @@ jobs:
if: steps.changed_files.outputs.any_changed == 'true'
run: |
echo '## Linter summary (recipes)' >> $GITHUB_STEP_SUMMARY
i=1
for file in recipes/*/*/conanfile.py; do
if [[ $i -gt 250 ]] ; then
break
fi
echo "$i - $file"
pylint --rcfile=linter/pylintrc_recipe $file --output-format=json --output=recipes.json --score=y --exit-zero
jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json
jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY
(( i += 1 ))
done
pylint --rcfile=linter/pylintrc_recipe `ls recipes/*/*/conanfile.py | shuf -n 500` --output-format=json --output=recipes.json --score=y --exit-zero
jq '[map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}] | sort_by(.length) | reverse' recipes.json > recipes2.json
jq -r '.[] | " * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY
- name: Execute linter over all test_package/recipes in the repository
id: linter_test_package
if: steps.changed_files.outputs.any_changed == 'true'
run: |
echo '## Linter summary (test_package)' >> $GITHUB_STEP_SUMMARY
i=1
for file in recipes/*/*/conanfile.py; do
if [[ $i -gt 250 ]] ; then
break
fi
echo "$i - $file"
pylint --rcfile=linter/pylintrc_testpackage $file --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py --output-format=json --output=recipes.json --exit-zero
jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json
jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY
(( i += 1 ))
done
pylint --rcfile=linter/pylintrc_testpackage `ls recipes/*/*/test_package/conanfile.py | shuf -n 500` --output-format=json --output=recipes.json --exit-zero
jq '[map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}] | sort_by(.length) | reverse' recipes.json > recipes2.json
jq -r '.[] | " * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY
conanfile_recipe:
name: Lint changed conanfile.py (v2 migration)
Expand Down

0 comments on commit 448983c

Please sign in to comment.