Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 1 | name: Server (Mariadb) |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 2 | |
Suraj Shetty | 9768783 | 2021-05-28 13:39:53 +0530 | [diff] [blame] | 3 | on: |
| 4 | pull_request: |
Ankush Menat | 8a6b82b | 2021-08-13 12:59:27 +0530 | [diff] [blame] | 5 | paths-ignore: |
| 6 | - '**.js' |
Ankush Menat | f1a7e3b | 2022-03-14 18:19:52 +0530 | [diff] [blame] | 7 | - '**.css' |
Ankush Menat | 8a6b82b | 2021-08-13 12:59:27 +0530 | [diff] [blame] | 8 | - '**.md' |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 9 | - '**.html' |
Ankush Menat | 0218f11 | 2023-07-19 12:17:32 +0530 | [diff] [blame^] | 10 | schedule: |
| 11 | # Run everday at midnight UTC / 5:30 IST |
| 12 | - cron: "0 0 * * *" |
Ankush Menat | 6f2c9c6 | 2022-02-03 17:30:42 +0530 | [diff] [blame] | 13 | workflow_dispatch: |
| 14 | inputs: |
| 15 | user: |
Ankush Menat | 7ee1518 | 2023-01-09 18:16:04 +0530 | [diff] [blame] | 16 | description: 'Frappe Framework repository user (add your username for forks)' |
Ankush Menat | 6f2c9c6 | 2022-02-03 17:30:42 +0530 | [diff] [blame] | 17 | required: true |
| 18 | default: 'frappe' |
| 19 | type: string |
| 20 | branch: |
Ankush Menat | 7ee1518 | 2023-01-09 18:16:04 +0530 | [diff] [blame] | 21 | description: 'Frappe Framework branch' |
Ankush Menat | 6f2c9c6 | 2022-02-03 17:30:42 +0530 | [diff] [blame] | 22 | default: 'develop' |
| 23 | required: false |
| 24 | type: string |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 25 | |
Ankush Menat | 9de0f75 | 2021-08-30 14:07:13 +0530 | [diff] [blame] | 26 | concurrency: |
Sagar Vora | a2252c9 | 2022-08-09 11:49:48 +0000 | [diff] [blame] | 27 | group: server-mariadb-develop-${{ github.event_name }}-${{ github.event.number || github.event_name == 'workflow_dispatch' && github.run_id || '' }} |
Ankush Menat | 9de0f75 | 2021-08-30 14:07:13 +0530 | [diff] [blame] | 28 | cancel-in-progress: true |
| 29 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 30 | jobs: |
| 31 | test: |
Ankush Menat | 602374a | 2021-08-30 18:24:48 +0530 | [diff] [blame] | 32 | runs-on: ubuntu-latest |
Ankush | 0bb60b3 | 2021-07-29 17:15:12 +0530 | [diff] [blame] | 33 | timeout-minutes: 60 |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 34 | |
| 35 | strategy: |
Suraj Shetty | 622bf07 | 2021-05-08 13:51:34 +0530 | [diff] [blame] | 36 | fail-fast: false |
Mohammad Hasnain Mohsin Rajan | 46d5431 | 2021-03-15 11:17:19 +0530 | [diff] [blame] | 37 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 38 | matrix: |
Ankush Menat | 56c6a70 | 2022-06-30 11:35:45 +0530 | [diff] [blame] | 39 | container: [1, 2, 3, 4] |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 40 | |
Suraj Shetty | 1f025a8 | 2021-05-12 18:14:22 +0530 | [diff] [blame] | 41 | name: Python Unit Tests |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 42 | |
| 43 | services: |
| 44 | mysql: |
Ankush Menat | d23b5d8 | 2022-12-06 12:58:07 +0530 | [diff] [blame] | 45 | image: mariadb:10.6 |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 46 | env: |
Ankush Menat | d23b5d8 | 2022-12-06 12:58:07 +0530 | [diff] [blame] | 47 | MARIADB_ROOT_PASSWORD: 'root' |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 48 | ports: |
| 49 | - 3306:3306 |
| 50 | options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |
| 51 | |
| 52 | steps: |
| 53 | - name: Clone |
| 54 | uses: actions/checkout@v2 |
| 55 | |
| 56 | - name: Setup Python |
| 57 | uses: actions/setup-python@v2 |
| 58 | with: |
Ankush Menat | c165536 | 2022-11-10 14:22:05 +0530 | [diff] [blame] | 59 | python-version: '3.11' |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 60 | |
Gavin D'souza | b07dd10 | 2022-07-04 11:11:14 +0530 | [diff] [blame] | 61 | - 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 Menat | e5e0070 | 2021-08-30 12:07:11 +0530 | [diff] [blame] | 69 | - name: Setup Node |
| 70 | uses: actions/setup-node@v2 |
| 71 | with: |
Suraj Shetty | 881e95b | 2023-06-26 13:02:08 +0530 | [diff] [blame] | 72 | node-version: 18 |
Ankush Menat | e5e0070 | 2021-08-30 12:07:11 +0530 | [diff] [blame] | 73 | check-latest: true |
| 74 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 75 | - 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 Menat | 20f8519 | 2022-06-29 12:23:17 +0530 | [diff] [blame] | 82 | key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }} |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 83 | restore-keys: | |
| 84 | ${{ runner.os }}-pip- |
| 85 | ${{ runner.os }}- |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 86 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 87 | - 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 Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 98 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 99 | - 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 Menat | 92c0dcc | 2021-10-20 14:43:39 +0530 | [diff] [blame] | 113 | env: |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 114 | DB: mariadb |
Ankush Menat | 92c0dcc | 2021-10-20 14:43:39 +0530 | [diff] [blame] | 115 | TYPE: server |
Ankush Menat | 6f2c9c6 | 2022-02-03 17:30:42 +0530 | [diff] [blame] | 116 | FRAPPE_USER: ${{ github.event.inputs.user }} |
| 117 | FRAPPE_BRANCH: ${{ github.event.inputs.branch }} |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 118 | |
| 119 | - name: Run Tests |
Ankush Menat | 6ce3ce7 | 2022-10-12 10:57:58 +0530 | [diff] [blame] | 120 | 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 Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 121 | env: |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 122 | TYPE: server |
Suraj Shetty | 7044bcf | 2021-05-09 11:29:00 +0530 | [diff] [blame] | 123 | CI_BUILD_ID: ${{ github.run_id }} |
Suraj Shetty | 6408367 | 2021-05-10 23:48:37 +0530 | [diff] [blame] | 124 | ORCHESTRATOR_URL: http://test-orchestrator.frappe.io |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 125 | |
Suraj Shetty | 1fc8fcc | 2021-09-10 08:08:00 +0530 | [diff] [blame] | 126 | - name: Upload coverage data |
Ankush Menat | c14c513 | 2022-04-10 15:06:38 +0530 | [diff] [blame] | 127 | uses: actions/upload-artifact@v3 |
| 128 | with: |
| 129 | name: coverage-${{ matrix.container }} |
| 130 | path: /home/runner/frappe-bench/sites/coverage.xml |
| 131 | |
| 132 | coverage: |
| 133 | name: Coverage Wrap Up |
| 134 | needs: test |
| 135 | runs-on: ubuntu-latest |
| 136 | steps: |
Ankush Menat | 71de754 | 2022-04-13 18:23:22 +0530 | [diff] [blame] | 137 | - name: Clone |
| 138 | uses: actions/checkout@v2 |
| 139 | |
Ankush Menat | c14c513 | 2022-04-10 15:06:38 +0530 | [diff] [blame] | 140 | - name: Download artifacts |
| 141 | uses: actions/download-artifact@v3 |
| 142 | |
| 143 | - name: Upload coverage data |
Suraj Shetty | 1fc8fcc | 2021-09-10 08:08:00 +0530 | [diff] [blame] | 144 | uses: codecov/codecov-action@v2 |
| 145 | with: |
| 146 | name: MariaDB |
| 147 | fail_ci_if_error: true |
Suraj Shetty | 1fc8fcc | 2021-09-10 08:08:00 +0530 | [diff] [blame] | 148 | verbose: true |