-
Notifications
You must be signed in to change notification settings - Fork 63
81 lines (71 loc) · 2.51 KB
/
pre-commit-workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#####################################################################
# Description: pre-commit-workflow.yaml
#
# This file, 'pre-commit-workflow.yaml', implements
# the Pre-commit git hooks managed CI/CD workflow
# for Machinekit-HAL code source-tree.
#
# Copyright (C) 2022 - Jakub Fišer <jakub DOT fiser AT eryaf DOT com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
######################################################################
name: Check the codebase for formatting and linting violations
on:
push:
branches:
- '*'
tags-ignore:
- 'v*'
pull_request:
branches:
- '*'
jobs:
checkFormattingAndLintingWithPreCommit:
name: >
Run the Pre-Commit git hook manager's tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Show GitHub context as a JSON
run: |
echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: >
Cancel any previous run of the same workflow
on the same branch
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Clone Machinekit-HAL repository
uses: actions/checkout@v2
with:
ref: '${{ github.event.ref }}'
- name: >
Prepare specific Python version for Machinekit-HAL
formatting and linting checks
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: >
Skip the 'no-commit-to-branch' on merge
to the 'master' branch
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
echo "SKIP=no-commit-to-branch" >> $GITHUB_ENV
- name: Run the Pre-Commit gith hooks manager
uses: pre-commit/[email protected]