forked from Wavyzz/dolibarr
Qual: Backport/pre commit / log annotation simplification (#28614)
* Qual: ci: Run pre-commit/php-cs with cache (#28079) This adds a hook to .pre-commit-config.yaml and updates the workflow to run php-cs with cache when it is run for all files. When running on changed files only, the cache is not useful. The php-codesniffer ruleset.xml was cleaned up (duplicates removal/formatted) * Fix: Make all 'relative paths' absolute (#28196) # Fix: Make all 'relative paths' absolute The phpcs ruleset xml file's relative exclude patterns are relative to the filename(s) provided on the command line. Hence with partial verifications, the path exclusion does not function as we would like. Removing the relative-path attribute from the patterns the exclusion works. At the same time, the patterns were optimized and a comment was added. * Qual: Optimize workflow (#28386) # Qual: Optimize workflow The log annotation based on the pre-commit logs is now simplified.
This commit is contained in:
18
.github/workflows/pre-commit.yml
vendored
18
.github/workflows/pre-commit.yml
vendored
@@ -7,7 +7,6 @@ jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
LOG_TO_CS: .github/logToCs.py
|
||||
RAW_LOG: pre-commit.log
|
||||
CS_XML: pre-commit.xml
|
||||
steps:
|
||||
@@ -37,7 +36,7 @@ jobs:
|
||||
with:
|
||||
cache: pip
|
||||
python-version: "3.11"
|
||||
- run: python -m pip install pre-commit regex
|
||||
- run: python -m pip install pre-commit
|
||||
# Restore previous cache of precommit
|
||||
- uses: actions/cache/restore@v4
|
||||
with:
|
||||
@@ -102,19 +101,12 @@ jobs:
|
||||
pre-commit run --hook-stage manual -a php-cs-with-cache | tee -a ${RAW_LOG}
|
||||
ls -l ~/.cache/pre-commit/
|
||||
|
||||
# If error, we convert log in the checkstyle format
|
||||
- name: Convert Raw Log to CheckStyle format
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
python ${LOG_TO_CS} ${RAW_LOG} ${CS_XML}
|
||||
# Annotate the git sources with the log messages
|
||||
- name: Annotate Source Code with Messages
|
||||
uses: staabm/annotate-pull-request-from-checkstyle-action@v1
|
||||
- name: Convert Raw Log to Annotations
|
||||
uses: mdeweerd/logToCheckStyle@v2024.2.9
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
files: ${{ env.CS_XML }}
|
||||
notices-as-warnings: true # optional
|
||||
prepend-filename: true # optional
|
||||
in: ${{ env.RAW_LOG }}
|
||||
|
||||
# Save the precommit cache
|
||||
- uses: actions/cache/save@v4
|
||||
if: ${{ ! cancelled() }}
|
||||
|
||||
Reference in New Issue
Block a user