Add the pre-commit job to the workflow

This commit is contained in:
Pedro Algarvio 2020-01-28 16:44:11 +00:00
parent a165c16553
commit b3b70c1561
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
3 changed files with 31 additions and 5 deletions

View file

@ -8,6 +8,28 @@ on: [push, pull_request]
jobs:
generate-actions-workflow:
name: Generate The Actions Workflow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Pre-Commit
run: |
pip install -U pip
pip install pre-commit
pre-commit install
- name: Generate Workflow Actions
run: |
pre-commit run -v generate-actions-workflow
Lint:
runs-on: ubuntu-latest
container: koalaman/shellcheck-alpine:v0.6.0
@ -18,7 +40,6 @@ jobs:
shellcheck -s sh -f checkstyle bootstrap-salt.sh
amazon-2-2019-2-py2-stable:
name: Amazon 2 2019.2 Py2 Stable
runs-on: ubuntu-latest

View file

@ -128,13 +128,19 @@ def generate_test_jobs():
with open('lint.yml') as rfh:
lint_job = '\n{}\n'.format(rfh.read())
with open('pre-commit.yml') as rfh:
pre_commit_job = '\n{}\n'.format(rfh.read())
with open('../main.yml', 'w') as wfh:
with open('main.yml') as rfh:
wfh.write(
'{}\n'.format(
rfh.read().format(
lint_job=lint_job,
test_jobs=test_jobs,
jobs='{pre_commit}{lint}{test}'.format(
lint=lint_job,
test=test_jobs,
pre_commit=pre_commit_job,
)
).strip()
)
)

View file

@ -7,5 +7,4 @@ name: Testing
on: [push, pull_request]
jobs:
{lint_job}
{test_jobs}
{jobs}