Add a gif demo to the README #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: pre-commit | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
env: | |
RAW_LOG: pre-commit.log | |
CS_XML: pre-commit.xml | |
steps: | |
- run: sudo apt-get update && sudo apt-get install cppcheck | |
if: false | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
if: false | |
with: | |
cache: pip | |
python-version: 3.12.1 | |
- run: python -m pip install pre-commit regex | |
- uses: actions/cache/restore@v4 | |
with: | |
path: | | |
~/.cache/pre-commit/ | |
bash_unit | |
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') | |
}} | |
- name: Run pre-commit hooks | |
env: | |
SKIP: no-commit-to-branch | |
run: | | |
set -o pipefail | |
pre-commit gc | |
# Run default pre-commit hooks | |
pre-commit run --show-diff-on-failure --color=always --all-files | tee ${RAW_LOG} | |
# Run this version of bash_unit using it's current pre-commit-hook.yaml config | |
# Useful for testing that the current version works | |
pre-commit try-repo . --verbose --all-files | tee -a ${RAW_LOG} | |
- name: Convert Raw Log to annotations | |
uses: mdeweerd/[email protected] | |
if: ${{ failure() }} | |
with: | |
in: ${{ env.RAW_LOG }} | |
# Out can be omitted if you do not need the xml output | |
# out: ${{ env.CS_XML }} | |
- uses: actions/cache/save@v4 | |
if: ${{ always() }} | |
with: | |
path: | | |
~/.cache/pre-commit/ | |
bash_unit | |
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') | |
}} | |
- name: Provide log as artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: precommit-logs | |
path: | | |
${{ env.RAW_LOG }} | |
${{ env.CS_XML }} | |
retention-days: 2 |