blob: 9b4db49d084ec09507e47e075e67f5d787128657 [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'
Suraj Shetty97687832021-05-28 13:39:53 +053010 push:
11 branches: [ develop ]
Ankush Menat8a6b82b2021-08-13 12:59:27 +053012 paths-ignore:
13 - '**.js'
14 - '**.md'
Ankush Menat6f2c9c62022-02-03 17:30:42 +053015 workflow_dispatch:
16 inputs:
17 user:
Ankush Menat7ee15182023-01-09 18:16:04 +053018 description: 'Frappe Framework repository user (add your username for forks)'
Ankush Menat6f2c9c62022-02-03 17:30:42 +053019 required: true
20 default: 'frappe'
21 type: string
22 branch:
Ankush Menat7ee15182023-01-09 18:16:04 +053023 description: 'Frappe Framework branch'
Ankush Menat6f2c9c62022-02-03 17:30:42 +053024 default: 'develop'
25 required: false
26 type: string
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053027
Ankush Menat9de0f752021-08-30 14:07:13 +053028concurrency:
Sagar Voraa2252c92022-08-09 11:49:48 +000029 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 +053030 cancel-in-progress: true
31
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053032jobs:
33 test:
Ankush Menat602374a2021-08-30 18:24:48 +053034 runs-on: ubuntu-latest
Ankush0bb60b32021-07-29 17:15:12 +053035 timeout-minutes: 60
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053036
37 strategy:
Suraj Shetty622bf072021-05-08 13:51:34 +053038 fail-fast: false
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053039
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053040 matrix:
Ankush Menat56c6a702022-06-30 11:35:45 +053041 container: [1, 2, 3, 4]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053042
Suraj Shetty1f025a82021-05-12 18:14:22 +053043 name: Python Unit Tests
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053044
45 services:
46 mysql:
Ankush Menatd23b5d82022-12-06 12:58:07 +053047 image: mariadb:10.6
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053048 env:
Ankush Menatd23b5d82022-12-06 12:58:07 +053049 MARIADB_ROOT_PASSWORD: 'root'
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053050 ports:
51 - 3306:3306
52 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
53
54 steps:
55 - name: Clone
56 uses: actions/checkout@v2
57
58 - name: Setup Python
59 uses: actions/setup-python@v2
60 with:
Ankush Menatc1655362022-11-10 14:22:05 +053061 python-version: '3.11'
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053062
Gavin D'souzab07dd102022-07-04 11:11:14 +053063 - name: Check for valid Python & Merge Conflicts
64 run: |
65 python -m compileall -f "${GITHUB_WORKSPACE}"
66 if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
67 then echo "Found merge conflicts"
68 exit 1
69 fi
70
Ankush Menate5e00702021-08-30 12:07:11 +053071 - name: Setup Node
72 uses: actions/setup-node@v2
73 with:
Suraj Shetty881e95b2023-06-26 13:02:08 +053074 node-version: 18
Ankush Menate5e00702021-08-30 12:07:11 +053075 check-latest: true
76
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053077 - name: Add to Hosts
78 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
79
80 - name: Cache pip
81 uses: actions/cache@v2
82 with:
83 path: ~/.cache/pip
Ankush Menat20f85192022-06-29 12:23:17 +053084 key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053085 restore-keys: |
86 ${{ runner.os }}-pip-
87 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053088
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053089 - name: Cache node modules
90 uses: actions/cache@v2
91 env:
92 cache-name: cache-node-modules
93 with:
94 path: ~/.npm
95 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
96 restore-keys: |
97 ${{ runner.os }}-build-${{ env.cache-name }}-
98 ${{ runner.os }}-build-
99 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +0530100
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530101 - name: Get yarn cache directory path
102 id: yarn-cache-dir-path
103 run: echo "::set-output name=dir::$(yarn cache dir)"
104
105 - uses: actions/cache@v2
106 id: yarn-cache
107 with:
108 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
109 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
110 restore-keys: |
111 ${{ runner.os }}-yarn-
112
113 - name: Install
114 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
Ankush Menat92c0dcc2021-10-20 14:43:39 +0530115 env:
Conord2074b12022-01-02 12:03:10 -0600116 DB: mariadb
Ankush Menat92c0dcc2021-10-20 14:43:39 +0530117 TYPE: server
Ankush Menat6f2c9c62022-02-03 17:30:42 +0530118 FRAPPE_USER: ${{ github.event.inputs.user }}
119 FRAPPE_BRANCH: ${{ github.event.inputs.branch }}
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530120
121 - name: Run Tests
Ankush Menat6ce3ce72022-10-12 10:57:58 +0530122 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 +0530123 env:
Suraj Shetty490aed22021-05-08 00:04:34 +0530124 TYPE: server
Suraj Shetty7044bcf2021-05-09 11:29:00 +0530125 CI_BUILD_ID: ${{ github.run_id }}
Suraj Shetty64083672021-05-10 23:48:37 +0530126 ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530127
Suraj Shetty1fc8fcc2021-09-10 08:08:00 +0530128 - name: Upload coverage data
Ankush Menatc14c5132022-04-10 15:06:38 +0530129 uses: actions/upload-artifact@v3
130 with:
131 name: coverage-${{ matrix.container }}
132 path: /home/runner/frappe-bench/sites/coverage.xml
133
134 coverage:
135 name: Coverage Wrap Up
136 needs: test
137 runs-on: ubuntu-latest
138 steps:
Ankush Menat71de7542022-04-13 18:23:22 +0530139 - name: Clone
140 uses: actions/checkout@v2
141
Ankush Menatc14c5132022-04-10 15:06:38 +0530142 - name: Download artifacts
143 uses: actions/download-artifact@v3
144
145 - name: Upload coverage data
Suraj Shetty1fc8fcc2021-09-10 08:08:00 +0530146 uses: codecov/codecov-action@v2
147 with:
148 name: MariaDB
149 fail_ci_if_error: true
Suraj Shetty1fc8fcc2021-09-10 08:08:00 +0530150 verbose: true