blob: ccdfc8c10939a886ee3b904d72c897f7900c85e6 [file] [log] [blame]
Conord2074b12022-01-02 12:03:10 -06001name: Server (Mariadb)
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05302
Suraj Shetty97687832021-05-28 13:39:53 +05303on:
4 pull_request:
Ankush Menat8a6b82b2021-08-13 12:59:27 +05305 paths-ignore:
6 - '**.js'
Ankush Menatf1a7e3b2022-03-14 18:19:52 +05307 - '**.css'
Ankush Menat8a6b82b2021-08-13 12:59:27 +05308 - '**.md'
Conord2074b12022-01-02 12:03:10 -06009 - '**.html'
Ankush Menat0218f112023-07-19 12:17:32 +053010 schedule:
11 # Run everday at midnight UTC / 5:30 IST
12 - cron: "0 0 * * *"
Ankush Menat6f2c9c62022-02-03 17:30:42 +053013 workflow_dispatch:
14 inputs:
15 user:
Ankush Menat7ee15182023-01-09 18:16:04 +053016 description: 'Frappe Framework repository user (add your username for forks)'
Ankush Menat6f2c9c62022-02-03 17:30:42 +053017 required: true
18 default: 'frappe'
19 type: string
20 branch:
Ankush Menat7ee15182023-01-09 18:16:04 +053021 description: 'Frappe Framework branch'
Ankush Menat6f2c9c62022-02-03 17:30:42 +053022 default: 'develop'
23 required: false
24 type: string
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053025
Ankush Menat9de0f752021-08-30 14:07:13 +053026concurrency:
Sagar Voraa2252c92022-08-09 11:49:48 +000027 group: server-mariadb-develop-${{ github.event_name }}-${{ github.event.number || github.event_name == 'workflow_dispatch' && github.run_id || '' }}
Ankush Menat9de0f752021-08-30 14:07:13 +053028 cancel-in-progress: true
29
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053030jobs:
31 test:
Ankush Menat602374a2021-08-30 18:24:48 +053032 runs-on: ubuntu-latest
Ankush0bb60b32021-07-29 17:15:12 +053033 timeout-minutes: 60
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053034
35 strategy:
Suraj Shetty622bf072021-05-08 13:51:34 +053036 fail-fast: false
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053037
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053038 matrix:
Ankush Menat56c6a702022-06-30 11:35:45 +053039 container: [1, 2, 3, 4]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053040
Suraj Shetty1f025a82021-05-12 18:14:22 +053041 name: Python Unit Tests
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053042
43 services:
44 mysql:
Ankush Menatd23b5d82022-12-06 12:58:07 +053045 image: mariadb:10.6
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053046 env:
Ankush Menatd23b5d82022-12-06 12:58:07 +053047 MARIADB_ROOT_PASSWORD: 'root'
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053048 ports:
49 - 3306:3306
Akhil Narang4a6108e2023-10-11 11:17:47 +053050 options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053051
52 steps:
53 - name: Clone
54 uses: actions/checkout@v2
55
56 - name: Setup Python
57 uses: actions/setup-python@v2
58 with:
Ankush Menatc1655362022-11-10 14:22:05 +053059 python-version: '3.11'
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053060
Gavin D'souzab07dd102022-07-04 11:11:14 +053061 - name: Check for valid Python & Merge Conflicts
62 run: |
63 python -m compileall -f "${GITHUB_WORKSPACE}"
64 if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
65 then echo "Found merge conflicts"
66 exit 1
67 fi
68
Ankush Menate5e00702021-08-30 12:07:11 +053069 - name: Setup Node
70 uses: actions/setup-node@v2
71 with:
Suraj Shetty881e95b2023-06-26 13:02:08 +053072 node-version: 18
Ankush Menate5e00702021-08-30 12:07:11 +053073 check-latest: true
74
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053075 - name: Add to Hosts
76 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
77
78 - name: Cache pip
79 uses: actions/cache@v2
80 with:
81 path: ~/.cache/pip
Ankush Menat20f85192022-06-29 12:23:17 +053082 key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053083 restore-keys: |
84 ${{ runner.os }}-pip-
85 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053086
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053087 - name: Cache node modules
88 uses: actions/cache@v2
89 env:
90 cache-name: cache-node-modules
91 with:
92 path: ~/.npm
93 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
94 restore-keys: |
95 ${{ runner.os }}-build-${{ env.cache-name }}-
96 ${{ runner.os }}-build-
97 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053098
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053099 - name: Get yarn cache directory path
100 id: yarn-cache-dir-path
101 run: echo "::set-output name=dir::$(yarn cache dir)"
102
103 - uses: actions/cache@v2
104 id: yarn-cache
105 with:
106 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
107 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
108 restore-keys: |
109 ${{ runner.os }}-yarn-
110
111 - name: Install
112 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
Ankush Menat92c0dcc2021-10-20 14:43:39 +0530113 env:
Conord2074b12022-01-02 12:03:10 -0600114 DB: mariadb
Ankush Menat92c0dcc2021-10-20 14:43:39 +0530115 TYPE: server
Ankush Menat6f2c9c62022-02-03 17:30:42 +0530116 FRAPPE_USER: ${{ github.event.inputs.user }}
117 FRAPPE_BRANCH: ${{ github.event.inputs.branch }}
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530118
119 - name: Run Tests
Ankush Menat6ce3ce72022-10-12 10:57:58 +0530120 run: 'cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --with-coverage --total-builds 4 --build-number ${{ matrix.container }}'
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530121 env:
Suraj Shetty490aed22021-05-08 00:04:34 +0530122 TYPE: server
Suraj Shetty7044bcf2021-05-09 11:29:00 +0530123 CI_BUILD_ID: ${{ github.run_id }}
Suraj Shetty64083672021-05-10 23:48:37 +0530124 ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530125
Ankush Menat2f7b3bb2023-09-14 14:46:45 +0530126 - name: Show bench output
127 if: ${{ always() }}
128 run: cat ~/frappe-bench/bench_start.log || true
129
Suraj Shetty1fc8fcc2021-09-10 08:08:00 +0530130 - name: Upload coverage data
Ankush Menatc14c5132022-04-10 15:06:38 +0530131 uses: actions/upload-artifact@v3
132 with:
133 name: coverage-${{ matrix.container }}
134 path: /home/runner/frappe-bench/sites/coverage.xml
135
136 coverage:
137 name: Coverage Wrap Up
138 needs: test
139 runs-on: ubuntu-latest
140 steps:
Ankush Menat71de7542022-04-13 18:23:22 +0530141 - name: Clone
142 uses: actions/checkout@v2
143
Ankush Menatc14c5132022-04-10 15:06:38 +0530144 - name: Download artifacts
145 uses: actions/download-artifact@v3
146
147 - name: Upload coverage data
Suraj Shetty1fc8fcc2021-09-10 08:08:00 +0530148 uses: codecov/codecov-action@v2
149 with:
150 name: MariaDB
151 fail_ci_if_error: true
Suraj Shetty1fc8fcc2021-09-10 08:08:00 +0530152 verbose: true