Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Backport

on:
pull_request_target:
types: [closed, labeled]

permissions:
contents: write
pull-requests: write

jobs:
backport:
name: Backport PR
if: >
github.event.pull_request.merged == true
&& contains(join(github.event.pull_request.labels.*.name, ','), 'backport-to-')
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Create backport PR(s)
uses: korthout/backport-action@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
label_pattern: "^backport-to-(.+)$"
merge_commits: "skip"
pull_title: "[Backport ${target_branch}] ${pull_title}"
pull_description: |
Backport of #${pull_number} to `${target_branch}`.
---
${pull_description}
copy_requested_reviewers: true
copy_assignees: true
copy_labels_pattern: "^(?!backport-to-)"
auto_merge_enabled: ${{ contains(join(github.event.pull_request.labels.*.name, ','), 'backport-auto-merge') }}

- name: Report backport status
if: failure()
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const pullNumber = context.payload.pull_request.number;
await github.rest.issues.createComment({
owner,
repo,
issue_number: pullNumber,
body: [
"⚠️ **Backport failed!**",
"",
"Automatic backport could not be completed. This is usually caused by cherry-pick conflicts or a missing target branch.",
"",
"Manual backport example:",
"",
"```bash",
"git checkout <target-branch>",
`git cherry-pick -x ${context.payload.pull_request.merge_commit_sha}`,
"```",
].join("\\n"),
});
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI

on:
push:
branches:
- develop
pull_request:

concurrency:
group: develop-clearing-${{ github.event.number }}
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-latest
name: Server

services:
redis-cache:
image: redis:alpine
ports:
- 13000:6379
redis-queue:
image: redis:alpine
ports:
- 11000:6379
mariadb:
image: mariadb:10.6
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Clone
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
check-latest: true

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-

- name: Install MariaDB Client
run: sudo apt-get install -y mariadb-client

- name: Setup
run: |
pip install frappe-bench
bench init --skip-redis-config-generation --skip-assets --frappe-branch version-15 --python "$(which python)" ~/frappe-bench
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"

- name: Install
working-directory: /home/runner/frappe-bench
run: |
bench get-app --skip-assets erpnext --branch version-15 --resolve-deps
bench get-app --skip-assets clearing $GITHUB_WORKSPACE --resolve-deps
bench setup requirements --dev
bench new-site --db-root-password root --admin-password admin test_site
bench --site test_site install-app erpnext
bench --site test_site install-app clearing
env:
CI: 'Yes'

- name: Smoke Test
working-directory: /home/runner/frappe-bench
run: |
bench --site test_site set-config allow_tests true
bench --site test_site execute erpnext.setup.utils.before_tests
bench --site test_site migrate
bench --site test_site list-apps
env:
TYPE: server
70 changes: 70 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Linters

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
linter:
name: 'Frappe Linter'
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit on changed files
run: |
pre-commit run \
--show-diff-on-failure \
--color=always \
--from-ref origin/${{ github.base_ref }} \
--to-ref HEAD

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

- name: Run Semgrep rules
run: |
pip install semgrep
semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness

deps-vulnerable-check:
name: 'Vulnerable Dependency Check'
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-

- name: Install and run pip-audit
run: |
pip install pip-audit
cd ${GITHUB_WORKSPACE}
pip-audit --desc on .
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Generate Semantic Release

on:
push:
branches:
- version-15
workflow_dispatch:

permissions:
contents: write
issues: write
pull-requests: write

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Entire Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Setup dependencies
run: |
npm install @semantic-release/git @semantic-release/exec --no-save

- name: Create Release
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: "Aakvatech Release Bot"
GIT_AUTHOR_EMAIL: "info@aakvatech.com"
GIT_COMMITTER_NAME: "Aakvatech Release Bot"
GIT_COMMITTER_EMAIL: "info@aakvatech.com"
run: npx semantic-release
Loading
Loading