Repository navigation
60 lines (56 loc) · 2.01 KB
/
Copy pathci.yml
File metadata and controls
60 lines (56 loc) · 2.01 KB
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
name: CI
# Every change reaches develop and main through a pull request, which is where CI runs.
on:
pull_request:
workflow_dispatch:
jobs:
# Documentation-only pull requests skip the tests. The test jobs still run, and pass,
# so the required checks report.
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.files.outputs.code }}
steps:
- id: files
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
run: |
code=true
if [ -n "$PR" ]; then
files=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR/files" --paginate --jq '.[].filename')
grep -qvE '\.md$|^docs/|^LICENSE$' <<< "$files" || code=false
fi
echo "code=$code" >> "$GITHUB_OUTPUT"
tests:
needs: changes
# Stable name for required checks, independent of the exact image.
name: v16
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
if: needs.changes.outputs.code == 'true'
# bench build writes into the app's public/ as the image's frappe user (uid 1000).
- run: chmod -R a+w access_grants/public
if: needs.changes.outputs.code == 'true'
- name: Tests in a disposable bench
if: needs.changes.outputs.code == 'true'
env:
# Renovate proposes new versions within v16 (renovate.json).
FRAPPE_IMAGE: frappe/erpnext:v16.36.0
run: tests/docker/run.sh
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.14'
- run: pip install pre-commit semgrep
- run: pre-commit run --all-files --show-diff-on-failure
- name: Frappe's Semgrep rules
run: |
git clone --depth 1 https://github.com/frappe/semgrep-rules.git /tmp/frappe-semgrep-rules
semgrep --error --config /tmp/frappe-semgrep-rules/rules --config r/python.lang.correctness .