Skip to content

Commit cc0a0e5

Browse files
ci: improve config (backport #198) (#199)
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
1 parent aacfe01 commit cc0a0e5

4 files changed

Lines changed: 85 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,29 @@
22
name: CI
33

44
on:
5-
push:
6-
branches:
7-
- develop
5+
workflow_dispatch:
86
pull_request:
7+
paths-ignore:
8+
- '**.js'
9+
- '**.css'
10+
- '**.md'
11+
- '**.html'
12+
- '**.csv'
13+
- '**.po'
14+
- '**.pot'
15+
- '.editorconfig'
16+
- '.eslintrc'
17+
- '.gitattributes'
18+
- '.gitignore'
19+
- '.pre-commit-config.yaml'
20+
- 'commitlint.config.js'
21+
- 'license.txt'
22+
- 'README.md'
23+
- '.github/workflows/copilot-setup-steps.yml'
24+
- '.github/workflows/linter.yml'
925

1026
concurrency:
11-
group: develop-eu_einvoice-${{ github.event.number }}
27+
group: version-14-eu_einvoice-${{ github.event.number }}
1228
cancel-in-progress: true
1329

1430
jobs:
@@ -52,7 +68,7 @@ jobs:
5268
- name: Setup Node
5369
uses: actions/setup-node@v3
5470
with:
55-
node-version: 18
71+
node-version: 16
5672
check-latest: true
5773

5874
- name: Cache pip
@@ -84,16 +100,18 @@ jobs:
84100
- name: Setup
85101
run: |
86102
pip install frappe-bench
87-
bench init --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench
103+
bench init --skip-redis-config-generation --skip-assets --python "$(which python)" --frappe-branch version-14 ~/frappe-bench
88104
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
89105
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
90106
91107
- name: Install
92108
working-directory: /home/runner/frappe-bench
93109
run: |
94-
bench get-app --resolve-deps eu_einvoice $GITHUB_WORKSPACE
110+
bench get-app erpnext --branch version-14
111+
bench get-app eu_einvoice $GITHUB_WORKSPACE
95112
bench setup requirements --dev
96113
bench new-site --db-root-password root --admin-password admin test_site
114+
bench --site test_site install-app erpnext
97115
bench --site test_site install-app eu_einvoice
98116
bench build
99117
env:

.github/workflows/linter.yml

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@
22
name: Linters
33

44
on:
5-
pull_request:
65
workflow_dispatch:
6+
pull_request:
7+
paths-ignore:
8+
- '**.md'
9+
- '**.html'
10+
- '**.csv'
11+
- '**.po'
12+
- '**.pot'
13+
- '.editorconfig'
14+
- '.gitattributes'
15+
- '.gitignore'
16+
- 'license.txt'
17+
- 'README.md'
18+
- '.github/workflows/copilot-setup-steps.yml'
719

820
permissions:
921
contents: read
@@ -13,18 +25,36 @@ concurrency:
1325
cancel-in-progress: true
1426

1527
jobs:
28+
commit-lint:
29+
name: 'Semantic Commits'
30+
runs-on: ubuntu-latest
31+
if: github.event_name == 'pull_request'
32+
33+
steps:
34+
- uses: actions/checkout@v5
35+
with:
36+
fetch-depth: 200
37+
- uses: actions/setup-node@v5
38+
with:
39+
node-version: 22
40+
check-latest: true
41+
42+
- name: Check commit titles
43+
run: |
44+
npm install @commitlint/cli @commitlint/config-conventional
45+
npx commitlint --verbose --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
46+
1647
linter:
17-
name: 'Frappe Linter'
48+
name: 'Semgrep Rules'
1849
runs-on: ubuntu-latest
1950
if: github.event_name == 'pull_request'
2051

2152
steps:
22-
- uses: actions/checkout@v4
23-
- uses: actions/setup-python@v5
53+
- uses: actions/checkout@v5
54+
- uses: actions/setup-python@v6
2455
with:
2556
python-version: '3.10'
2657
cache: pip
27-
- uses: pre-commit/action@v3.0.0
2858

2959
- name: Download Semgrep rules
3060
run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules
@@ -39,14 +69,14 @@ jobs:
3969
runs-on: ubuntu-latest
4070

4171
steps:
42-
- uses: actions/setup-python@v5
72+
- uses: actions/setup-python@v6
4373
with:
4474
python-version: '3.10'
4575

46-
- uses: actions/checkout@v4
76+
- uses: actions/checkout@v5
4777

4878
- name: Cache pip
49-
uses: actions/cache@v3
79+
uses: actions/cache@v4
5080
with:
5181
path: ~/.cache/pip
5282
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
@@ -59,3 +89,16 @@ jobs:
5989
pip install pip-audit
6090
cd ${GITHUB_WORKSPACE}
6191
pip-audit --desc on .
92+
93+
precommit:
94+
name: 'Pre-Commit'
95+
runs-on: ubuntu-latest
96+
if: github.event_name == 'pull_request'
97+
98+
steps:
99+
- uses: actions/checkout@v5
100+
- uses: actions/setup-python@v6
101+
with:
102+
python-version: '3.10'
103+
cache: pip
104+
- uses: pre-commit/action@v3.0.1

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
exclude: 'node_modules|.git'
22
default_stages: [pre-commit]
3+
default_install_hook_types: [pre-commit, commit-msg]
34
fail_fast: false
45

56

@@ -61,6 +62,13 @@ repos:
6162
eu_einvoice/public/js/lib/.*
6263
)$
6364
65+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
66+
rev: v9.22.0
67+
hooks:
68+
- id: commitlint
69+
stages: [commit-msg]
70+
additional_dependencies: ["@commitlint/config-conventional"]
71+
6472
ci:
6573
autoupdate_schedule: weekly
6674
skip: []

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ["@commitlint/config-conventional"] };

0 commit comments

Comments
 (0)