Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 1 | name: CI |
| 2 | |
Suraj Shetty | 85dd5d2 | 2021-05-06 13:05:03 +0530 | [diff] [blame] | 3 | on: [pull_request, workflow_dispatch] |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 4 | |
| 5 | jobs: |
| 6 | test: |
Mohammad Hasnain Mohsin Rajan | 192ab05 | 2021-03-18 17:12:12 +0530 | [diff] [blame] | 7 | runs-on: ubuntu-18.04 |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 8 | |
| 9 | strategy: |
| 10 | fail-fast: false |
Mohammad Hasnain Mohsin Rajan | 46d5431 | 2021-03-15 11:17:19 +0530 | [diff] [blame] | 11 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 12 | matrix: |
| 13 | include: |
| 14 | - TYPE: "server" |
Suraj Shetty | 3b69aa8 | 2021-05-07 00:32:00 +0530 | [diff] [blame^] | 15 | JOB_NAME: "Server.1" |
Suraj Shetty | 591f3f0 | 2021-05-04 18:36:45 +0530 | [diff] [blame] | 16 | RUN_COMMAND: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --with-coverage --ci-build-id $GITHUB_RUN_ID --app erpnext |
| 17 | - TYPE: "server" |
Suraj Shetty | 3b69aa8 | 2021-05-07 00:32:00 +0530 | [diff] [blame^] | 18 | JOB_NAME: "Server.2" |
Suraj Shetty | 591f3f0 | 2021-05-04 18:36:45 +0530 | [diff] [blame] | 19 | RUN_COMMAND: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --with-coverage --ci-build-id $GITHUB_RUN_ID --app erpnext |
Suraj Shetty | 0f3d862 | 2021-05-06 15:13:09 +0530 | [diff] [blame] | 20 | - TYPE: "server" |
Suraj Shetty | 3b69aa8 | 2021-05-07 00:32:00 +0530 | [diff] [blame^] | 21 | JOB_NAME: "Server.3" |
Suraj Shetty | 0f3d862 | 2021-05-06 15:13:09 +0530 | [diff] [blame] | 22 | RUN_COMMAND: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --with-coverage --ci-build-id $GITHUB_RUN_ID --app erpnext |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 23 | - TYPE: "patch" |
| 24 | JOB_NAME: "Patch" |
Mohammad Hasnain Mohsin Rajan | 46d5431 | 2021-03-15 11:17:19 +0530 | [diff] [blame] | 25 | RUN_COMMAND: cd ~/frappe-bench/ && wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz && bench --site test_site --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz && bench --site test_site migrate |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 26 | |
| 27 | name: ${{ matrix.JOB_NAME }} |
| 28 | |
| 29 | services: |
| 30 | mysql: |
| 31 | image: mariadb:10.3 |
| 32 | env: |
| 33 | MYSQL_ALLOW_EMPTY_PASSWORD: YES |
| 34 | ports: |
| 35 | - 3306:3306 |
| 36 | options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |
| 37 | |
| 38 | steps: |
| 39 | - name: Clone |
| 40 | uses: actions/checkout@v2 |
| 41 | |
| 42 | - name: Setup Python |
| 43 | uses: actions/setup-python@v2 |
| 44 | with: |
| 45 | python-version: 3.6 |
| 46 | |
| 47 | - name: Add to Hosts |
| 48 | run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts |
| 49 | |
| 50 | - name: Cache pip |
| 51 | uses: actions/cache@v2 |
| 52 | with: |
| 53 | path: ~/.cache/pip |
| 54 | key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 55 | restore-keys: | |
| 56 | ${{ runner.os }}-pip- |
| 57 | ${{ runner.os }}- |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 58 | - name: Cache node modules |
| 59 | uses: actions/cache@v2 |
| 60 | env: |
| 61 | cache-name: cache-node-modules |
| 62 | with: |
| 63 | path: ~/.npm |
| 64 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 65 | restore-keys: | |
| 66 | ${{ runner.os }}-build-${{ env.cache-name }}- |
| 67 | ${{ runner.os }}-build- |
| 68 | ${{ runner.os }}- |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 69 | - name: Get yarn cache directory path |
| 70 | id: yarn-cache-dir-path |
| 71 | run: echo "::set-output name=dir::$(yarn cache dir)" |
| 72 | |
| 73 | - uses: actions/cache@v2 |
| 74 | id: yarn-cache |
| 75 | with: |
| 76 | path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 77 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 78 | restore-keys: | |
| 79 | ${{ runner.os }}-yarn- |
| 80 | |
| 81 | - name: Install |
| 82 | run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh |
| 83 | |
| 84 | - name: Run Tests |
Mohammad Hasnain Mohsin Rajan | 46d5431 | 2021-03-15 11:17:19 +0530 | [diff] [blame] | 85 | run: ${{ matrix.RUN_COMMAND }} |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 86 | env: |
| 87 | TYPE: ${{ matrix.TYPE }} |
| 88 | |
Suraj Shetty | 3b69aa8 | 2021-05-07 00:32:00 +0530 | [diff] [blame^] | 89 | - name: Upload Coverage Data |
| 90 | if: matrix.TYPE == 'server' |
| 91 | run: | |
| 92 | cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE} |
| 93 | cd ${GITHUB_WORKSPACE} |
| 94 | pip3 install coverage==5.5 |
| 95 | pip3 install coveralls==3.0.1 |
| 96 | coveralls --service=github-actions |
| 97 | env: |
| 98 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 99 | COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} |
| 100 | COVERALLS_FLAG_NAME: run-${{ matrix.container }} |
| 101 | COVERALLS_SERVICE_NAME: github-actions |
| 102 | COVERALLS_PARALLEL: true |
Suraj Shetty | 591f3f0 | 2021-05-04 18:36:45 +0530 | [diff] [blame] | 103 | |
Suraj Shetty | 3b69aa8 | 2021-05-07 00:32:00 +0530 | [diff] [blame^] | 104 | coveralls: |
| 105 | name: Coverage Wrap Up |
| 106 | needs: test |
| 107 | container: python:3-slim |
| 108 | runs-on: ubuntu-18.04 |
| 109 | steps: |
| 110 | - name: Clone |
| 111 | uses: actions/checkout@v2 |
| 112 | |
| 113 | - name: Coveralls Finished |
| 114 | run: | |
| 115 | cd ${GITHUB_WORKSPACE} |
| 116 | ls -al |
| 117 | pip3 install coverage==5.5 |
| 118 | pip3 install coveralls==3.0.1 |
| 119 | coveralls --finish |
| 120 | env: |
| 121 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Mohammad Hasnain Mohsin Rajan | 0dc0021 | 2021-04-29 15:21:16 +0530 | [diff] [blame] | 122 | |