Skip to content

Commit b42c6e8

Browse files
authored
Merge pull request #1665 from frappe/main-hotfix
2 parents abb58d6 + 08b021c commit b42c6e8

File tree

32 files changed

+457
-206
lines changed

32 files changed

+457
-206
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish Coverage to Codecov
2+
description: Upload downloaded coverage artifacts to Codecov.
3+
inputs:
4+
name:
5+
description: Coverage upload name in Codecov
6+
required: false
7+
default: "MariaDB"
8+
token:
9+
description: Codecov upload token
10+
required: true
11+
fail-ci-if-error:
12+
description: Fail workflow if Codecov upload fails
13+
required: false
14+
default: "true"
15+
verbose:
16+
description: Enable verbose Codecov logging
17+
required: false
18+
default: "true"
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Upload coverage data
23+
uses: codecov/codecov-action@v4
24+
with:
25+
name: ${{ inputs.name }}
26+
token: ${{ inputs.token }}
27+
fail_ci_if_error: ${{ inputs.fail-ci-if-error }}
28+
verbose: ${{ inputs.verbose }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Run CRM Server Tests
2+
description: Execute bench tests for the CRM app with optional coverage collection.
3+
inputs:
4+
bench-path:
5+
description: Absolute path to the bench directory
6+
required: false
7+
default: "/home/runner/frappe-bench"
8+
site:
9+
description: Bench site on which to run tests
10+
required: false
11+
default: "test_site"
12+
app:
13+
description: App to test
14+
required: false
15+
default: "crm"
16+
enable-coverage:
17+
description: When true, include coverage flag during test execution
18+
required: false
19+
default: "true"
20+
type:
21+
description: Bench command type environment variable
22+
required: false
23+
default: "server"
24+
ci-build-id:
25+
description: CI build identifier propagated to bench commands
26+
required: false
27+
runs:
28+
using: composite
29+
steps:
30+
- name: Run Tests
31+
shell: bash
32+
working-directory: ${{ inputs.bench-path }}
33+
env:
34+
TYPE: ${{ inputs.type }}
35+
CI_BUILD_ID: ${{ inputs.ci-build-id }}
36+
run: |
37+
bench --site "${{ inputs.site }}" set-config allow_tests true
38+
if [ "${{ inputs.enable-coverage }}" = "true" ]; then
39+
bench --site "${{ inputs.site }}" run-tests --app "${{ inputs.app }}" --coverage
40+
else
41+
bench --site "${{ inputs.site }}" run-tests --app "${{ inputs.app }}"
42+
fi
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Setup Server Environment
2+
description: Prepare Python, Node, caching, and bench prerequisites for CRM server tests.
3+
inputs:
4+
python-version:
5+
description: Python version to install
6+
required: false
7+
default: "3.14"
8+
node-version:
9+
description: Node version to install
10+
required: false
11+
default: "24"
12+
type:
13+
description: Bench install type passed to install script
14+
required: false
15+
default: "server"
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Setup Python
20+
uses: actions/setup-python@v6
21+
with:
22+
python-version: ${{ inputs.python-version }}
23+
24+
- name: Check for valid Python & merge conflicts
25+
shell: bash
26+
run: |
27+
python -m compileall -f "${GITHUB_WORKSPACE}"
28+
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"; then
29+
echo "Found merge conflicts"
30+
exit 1
31+
fi
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v6
35+
with:
36+
node-version: ${{ inputs.node-version }}
37+
check-latest: true
38+
39+
- name: Install Yarn
40+
shell: bash
41+
run: npm install -g yarn
42+
43+
- name: Add to hosts file
44+
shell: bash
45+
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
46+
47+
- name: Cache pip
48+
uses: actions/cache@v4
49+
with:
50+
path: ~/.cache/pip
51+
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
52+
restore-keys: |
53+
${{ runner.os }}-pip-
54+
${{ runner.os }}-
55+
56+
- name: Cache node modules
57+
uses: actions/cache@v4
58+
env:
59+
cache-name: cache-node-modules
60+
with:
61+
path: ~/.npm
62+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
63+
restore-keys: |
64+
${{ runner.os }}-build-${{ env.cache-name }}-
65+
${{ runner.os }}-build-
66+
${{ runner.os }}-
67+
68+
- name: Get yarn cache directory path
69+
id: yarn-cache-dir-path
70+
shell: bash
71+
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}"
72+
73+
- name: Cache yarn
74+
uses: actions/cache@v4
75+
with:
76+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
77+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
78+
restore-keys: |
79+
${{ runner.os }}-yarn-
80+
81+
- name: Install bench dependencies
82+
shell: bash
83+
env:
84+
TYPE: ${{ inputs.type }}
85+
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Upload Coverage Artifact
2+
description: Persist coverage artifacts produced during CRM server testing.
3+
inputs:
4+
artifact-name:
5+
description: Name assigned to the uploaded artifact
6+
required: false
7+
default: "coverage-server"
8+
coverage-path:
9+
description: Path to the coverage XML or directory to upload
10+
required: true
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Upload coverage data
15+
uses: actions/upload-artifact@v4
16+
with:
17+
name: ${{ inputs.artifact-name }}
18+
path: ${{ inputs.coverage-path }}

.github/workflows/ci.yml

Lines changed: 0 additions & 115 deletions
This file was deleted.

.github/workflows/linters.yml

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,78 @@
1-
name: Lint
1+
name: Linters
22

33
on:
4-
pull_request: {}
4+
pull_request:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
pull-requests: read
510

611
jobs:
712
commit-lint:
813
name: Semantic Commits
914
runs-on: ubuntu-latest
10-
if: github.event_name == 'pull_request'
1115

1216
steps:
1317
- uses: actions/checkout@v6
1418
with:
1519
fetch-depth: 200
20+
1621
- uses: actions/setup-node@v6
1722
with:
18-
node-version: 24
23+
node-version: "24"
1924
check-latest: true
25+
26+
- name: Install commitlint
27+
run: npm install --no-save @commitlint/cli @commitlint/config-conventional
28+
2029
- name: Check commit titles
21-
run: |
22-
npm install @commitlint/cli @commitlint/config-conventional
23-
npx commitlint --verbose --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
30+
run: npx commitlint --verbose --from "${{ github.event.pull_request.base.sha }}" --to "${{ github.event.pull_request.head.sha }}"
2431

25-
linter:
26-
name: "Frappe Linter"
32+
semgrep:
33+
name: Semgrep Rules
2734
runs-on: ubuntu-latest
28-
if: github.event_name == 'pull_request'
35+
36+
env:
37+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
38+
PYTHONDONTWRITEBYTECODE: "1"
2939

3040
steps:
3141
- uses: actions/checkout@v6
3242

33-
- name: Set up Python 3.14
43+
- name: Set up Python
3444
uses: actions/setup-python@v6
3545
with:
3646
python-version: "3.14"
47+
cache: pip
3748

38-
- name: Install and Run Pre-commit
39-
uses: pre-commit/action@v3.0.1
49+
- name: Install Semgrep
50+
run: pip install --upgrade semgrep
4051

4152
- name: Download Semgrep rules
4253
run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules
4354

44-
- name: Download semgrep
45-
run: pip install semgrep
46-
4755
- name: Run Semgrep rules
4856
run: semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness
57+
58+
pre-commit:
59+
name: Pre-commit Checks
60+
runs-on: ubuntu-latest
61+
62+
env:
63+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
64+
PYTHONDONTWRITEBYTECODE: "1"
65+
66+
steps:
67+
- uses: actions/checkout@v6
68+
69+
- name: Set up Python
70+
uses: actions/setup-python@v6
71+
with:
72+
python-version: "3.14"
73+
cache: pip
74+
75+
- name: Run Pre-commit
76+
uses: pre-commit/action@v3.0.1
77+
with:
78+
extra_args: --all-files

0 commit comments

Comments
 (0)