mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Allow running the pre-commit jenkins job in GH Actions
This commit is contained in:
parent
50701b3573
commit
5f4ed3b3f4
2 changed files with 61 additions and 3 deletions
55
.github/workflows/pre-commit.yml
vendored
Normal file
55
.github/workflows/pre-commit.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
name: Pre-Commit
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
Pre-Commit:
|
||||
name: Run Pre-Commit Against Salt
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container:
|
||||
image: python:3.8.6-slim-buster
|
||||
|
||||
steps:
|
||||
|
||||
- name: Install System Deps
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y enchant 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@v2
|
||||
|
||||
- name: Set Pre-Commit Cache Key
|
||||
run: echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup Pre-Commit Cache
|
||||
uses: pat-s/always-upload-cache@v2.1.3
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
|
||||
- id: changed-files
|
||||
name: Get Changed Files
|
||||
uses: dorny/paths-filter@v2
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
list-files: shell
|
||||
filters: |
|
||||
repo:
|
||||
- added|modified:
|
||||
- '**'
|
||||
|
||||
- name: Check ALL Files On Branch
|
||||
uses: pre-commit/action@v2.0.0
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
SKIP: lint-salt,lint-tests,pyupgrade,remove-import-headers,rstcheck
|
||||
|
||||
- name: Check Changed Files On PR
|
||||
uses: pre-commit/action@v2.0.0
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
extra_args: --files ${{ steps.changed-files.outputs.repo_files }}
|
||||
env:
|
||||
SKIP: lint-salt,lint-tests
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
tasks.utils
|
||||
~~~~~~~~~~~
|
||||
|
@ -11,8 +10,12 @@ import sys
|
|||
try:
|
||||
from blessings import Terminal
|
||||
|
||||
terminal = Terminal()
|
||||
HAS_BLESSINGS = True
|
||||
try:
|
||||
terminal = Terminal()
|
||||
HAS_BLESSINGS = True
|
||||
except Exception: # pylint: disable=broad-except
|
||||
terminal = None
|
||||
HAS_BLESSINGS = False
|
||||
except ImportError:
|
||||
terminal = None
|
||||
HAS_BLESSINGS = False
|
||||
|
|
Loading…
Add table
Reference in a new issue