-
Notifications
You must be signed in to change notification settings - Fork 7
158 lines (134 loc) · 4.2 KB
/
lint.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Linters
on:
push:
branches:
- version-14
pull_request:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
mypy:
needs: [ py_json_merge ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install mypy
run: pip install mypy
- name: Run mypy
uses: sasanquaneuf/mypy-github-action@releases/v1
with:
checkName: 'mypy'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
black:
needs: [ py_json_merge ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install Black (Frappe)
run: pip install git+https://github.com/frappe/black.git
- name: Run Black (Frappe)
run: black --check .
prettier:
needs: [ py_json_merge ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 2
- name: Prettify code
uses: creyD/[email protected]
with:
commit_message: "style: prettify code"
json_diff:
needs: [ py_json_merge ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 2
- name: Find JSON changes
id: changed-json
uses: tj-actions/changed-files@v37
with:
files: |
**/*.json
include_all_old_new_renamed_files: true
- name: Copy head paths files
run: |
mkdir head
touch head/acmr.txt
for file in ${{ steps.changed-json.outputs.added_files }}; do
echo "A,head/${file}" >> head/acmr.txt
cp --parents $file head/
done
for file in ${{ steps.changed-json.outputs.copied_files }}; do
echo "C,head/${file}" >> head/acmr.txt
cp --parents $file head/
done
for file in ${{ steps.changed-json.outputs.modified_files }}; do
echo "M,head/${file}" >> head/acmr.txt
cp --parents $file head/
done
for file in ${{ steps.changed-json.outputs.renamed_files }}; do
echo "R,head/${file}" >> head/acmr.txt
cp --parents $file head/
done
- name: Checkout base
run: git checkout $(git --no-pager log --oneline -n 2 | awk 'NR==2 {print $1}')
- name: Copy base paths
run: |
mkdir base
touch base/mrd.txt
for file in ${{ steps.changed-json.outputs.modified_files }}; do
echo "M,${file}" >> base/mrd.txt
done
for file in ${{ steps.changed-json.outputs.all_old_new_renamed_files }}; do
echo "R,${file}" >> base/mrd.txt
done
for file in ${{ steps.changed-json.outputs.deleted_files }}; do
echo "D,${file}" >> base/mrd.txt
done
- name: Setup requirements and script
run: |
pip install rich
pip install json_source_map
git clone --depth 1 https://gist.github.com/3eea518743067f1b971114f1a2016f69 fsjd
- name: Diff table
run: python3 fsjd/frappe_schema_json_diff.py base/mrd.txt head/acmr.txt 1
py_json_merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Fetch validator
run: git clone --depth 1 https://gist.github.com/f1bf2c11f78331b2417189c385022c28.git validate_json
- name: Validate JSON
run: python3 validate_json/validate_json.py ./
- name: Compile
run: python3 -m compileall -q ./
- name: Check merge
run: |
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
then echo "Found merge conflicts"
exit 1
fi