Added pytests for logging #2
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, pull_request] | |
permissions: | |
contents: read # for dorny/paths-filter to fetch a list of changed files | |
pull-requests: read # for dorny/paths-filter to read pull requests | |
jobs: | |
Pre-Commit: | |
name: Run Pre-Commit Against Salt | |
runs-on: ${{ github.event.repository.private && fromJSON('["self-hosted", "linux", "x86_64"]') || 'ubuntu-latest' }} | |
container: | |
image: ghcr.io/saltstack/salt-ci-containers/python:3.8 | |
steps: | |
- name: Install System Deps | |
run: | | |
apt-get update | |
apt-get upgrade debian-keyring -y | |
echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list | |
apt-get update | |
apt-get install -y enchant-2 git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev | |
- uses: actions/checkout@v3 | |
- name: Add Git Safe Directory | |
run: | | |
git config --global --add safe.directory $(pwd) | |
- name: Install Pre-Commit | |
env: | |
PIP_EXTRA_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/ | |
run: | | |
git config --global --add safe.directory $(pwd) | |
python -m pip install --upgrade pip | |
pip install pre-commit | |
pre-commit install --install-hooks || cat /root/.cache/pre-commit/pre-commit.log | |
- id: changed-files | |
name: Get Changed Files | |
uses: dorny/paths-filter@v2 | |
with: | |
token: ${{ github.token }} | |
list-files: json | |
filters: | | |
repo: | |
- added|modified: | |
- '**' | |
deleted: | |
- deleted: | |
- '**' | |
- name: Check ALL Files On Branch | |
if: github.event_name != 'pull_request' | |
env: | |
SKIP: lint-salt,lint-tests,remove-import-headers,rstcheck | |
run: | | |
pre-commit run --show-diff-on-failure --color=always --all-files | |
- name: Check Changed Files On PR | |
if: github.event_name == 'pull_request' && steps.changed-files.outputs.repo == 'true' | |
env: | |
SKIP: lint-salt,lint-tests | |
run: | | |
pre-commit run --show-diff-on-failure --color=always --files ${{ join(fromJSON(steps.changed-files.outputs.repo_files), ' ') }} | |
- name: Check Docs On Deleted Files | |
if: steps.changed-files.outputs.deleted == 'true' | |
env: | |
PIP_EXTRA_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/ | |
run: | | |
pre-commit run --show-diff-on-failure --color=always check-docs --files ${{ join(fromJSON(steps.changed-files.outputs.deleted_files), ' ') }} |