Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 1 | name: Server |
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' |
| 7 | - '**.md' |
Suraj Shetty | 9768783 | 2021-05-28 13:39:53 +0530 | [diff] [blame] | 8 | workflow_dispatch: |
| 9 | push: |
| 10 | branches: [ develop ] |
Ankush Menat | 8a6b82b | 2021-08-13 12:59:27 +0530 | [diff] [blame] | 11 | paths-ignore: |
| 12 | - '**.js' |
| 13 | - '**.md' |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 14 | |
Ankush Menat | 9de0f75 | 2021-08-30 14:07:13 +0530 | [diff] [blame] | 15 | concurrency: |
| 16 | group: server-develop-${{ github.event.number }} |
| 17 | cancel-in-progress: true |
| 18 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 19 | jobs: |
| 20 | test: |
Ankush Menat | 602374a | 2021-08-30 18:24:48 +0530 | [diff] [blame] | 21 | runs-on: ubuntu-latest |
Ankush | 0bb60b3 | 2021-07-29 17:15:12 +0530 | [diff] [blame] | 22 | timeout-minutes: 60 |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 23 | |
| 24 | strategy: |
Suraj Shetty | 622bf07 | 2021-05-08 13:51:34 +0530 | [diff] [blame] | 25 | fail-fast: false |
Mohammad Hasnain Mohsin Rajan | 46d5431 | 2021-03-15 11:17:19 +0530 | [diff] [blame] | 26 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 27 | matrix: |
Suraj Shetty | 042118a | 2021-05-11 10:09:06 +0530 | [diff] [blame] | 28 | container: [1, 2, 3] |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 29 | |
Suraj Shetty | 1f025a8 | 2021-05-12 18:14:22 +0530 | [diff] [blame] | 30 | name: Python Unit Tests |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 31 | |
| 32 | services: |
| 33 | mysql: |
| 34 | image: mariadb:10.3 |
| 35 | env: |
| 36 | MYSQL_ALLOW_EMPTY_PASSWORD: YES |
| 37 | ports: |
| 38 | - 3306:3306 |
| 39 | options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |
| 40 | |
| 41 | steps: |
| 42 | - name: Clone |
| 43 | uses: actions/checkout@v2 |
| 44 | |
| 45 | - name: Setup Python |
| 46 | uses: actions/setup-python@v2 |
| 47 | with: |
Suraj Shetty | 28fdb2e | 2021-05-12 23:13:11 +0530 | [diff] [blame] | 48 | python-version: 3.7 |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 49 | |
Ankush Menat | e5e0070 | 2021-08-30 12:07:11 +0530 | [diff] [blame] | 50 | - name: Setup Node |
| 51 | uses: actions/setup-node@v2 |
| 52 | with: |
| 53 | node-version: 14 |
| 54 | check-latest: true |
| 55 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 56 | - name: Add to Hosts |
| 57 | run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts |
| 58 | |
| 59 | - name: Cache pip |
| 60 | uses: actions/cache@v2 |
| 61 | with: |
| 62 | path: ~/.cache/pip |
| 63 | key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 64 | restore-keys: | |
| 65 | ${{ runner.os }}-pip- |
| 66 | ${{ runner.os }}- |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 67 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 68 | - name: Cache node modules |
| 69 | uses: actions/cache@v2 |
| 70 | env: |
| 71 | cache-name: cache-node-modules |
| 72 | with: |
| 73 | path: ~/.npm |
| 74 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 75 | restore-keys: | |
| 76 | ${{ runner.os }}-build-${{ env.cache-name }}- |
| 77 | ${{ runner.os }}-build- |
| 78 | ${{ runner.os }}- |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 79 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 80 | - name: Get yarn cache directory path |
| 81 | id: yarn-cache-dir-path |
| 82 | run: echo "::set-output name=dir::$(yarn cache dir)" |
| 83 | |
| 84 | - uses: actions/cache@v2 |
| 85 | id: yarn-cache |
| 86 | with: |
| 87 | path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 88 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 89 | restore-keys: | |
| 90 | ${{ runner.os }}-yarn- |
| 91 | |
| 92 | - name: Install |
| 93 | run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh |
Ankush Menat | 92c0dcc | 2021-10-20 14:43:39 +0530 | [diff] [blame] | 94 | env: |
| 95 | TYPE: server |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 96 | |
| 97 | - name: Run Tests |
Suraj Shetty | 7044bcf | 2021-05-09 11:29:00 +0530 | [diff] [blame] | 98 | run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --use-orchestrator --with-coverage |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 99 | env: |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 100 | TYPE: server |
Suraj Shetty | 7044bcf | 2021-05-09 11:29:00 +0530 | [diff] [blame] | 101 | CI_BUILD_ID: ${{ github.run_id }} |
Suraj Shetty | 6408367 | 2021-05-10 23:48:37 +0530 | [diff] [blame] | 102 | ORCHESTRATOR_URL: http://test-orchestrator.frappe.io |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 103 | |
Suraj Shetty | 1fc8fcc | 2021-09-10 08:08:00 +0530 | [diff] [blame] | 104 | - name: Upload coverage data |
| 105 | uses: codecov/codecov-action@v2 |
| 106 | with: |
| 107 | name: MariaDB |
| 108 | fail_ci_if_error: true |
| 109 | files: /home/runner/frappe-bench/sites/coverage.xml |
| 110 | verbose: true |