blob: bd60081064267cd45fde52823f09d0d237f66f8e [file] [log] [blame]
Suraj Shetty490aed22021-05-08 00:04:34 +05301name: Server
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05302
Suraj Shettyaf4af772021-05-06 13:05:03 +05303on: [pull_request, workflow_dispatch]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05304
5jobs:
6 test:
Mohammad Hasnain Mohsin Rajan192ab052021-03-18 17:12:12 +05307 runs-on: ubuntu-18.04
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05308
9 strategy:
Suraj Shetty622bf072021-05-08 13:51:34 +053010 fail-fast: false
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053011
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053012 matrix:
Suraj Shettydfb8aa02021-05-09 14:38:54 +053013 container: [1, 2, 3, 4]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053014
Suraj Shetty490aed22021-05-08 00:04:34 +053015 name: Server Tests
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053016
17 services:
18 mysql:
19 image: mariadb:10.3
20 env:
21 MYSQL_ALLOW_EMPTY_PASSWORD: YES
22 ports:
23 - 3306:3306
24 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
25
26 steps:
27 - name: Clone
28 uses: actions/checkout@v2
29
30 - name: Setup Python
31 uses: actions/setup-python@v2
32 with:
Suraj Shettydfb8aa02021-05-09 14:38:54 +053033 python-version: 3.6
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053034
35 - name: Add to Hosts
36 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
37
38 - name: Cache pip
39 uses: actions/cache@v2
40 with:
41 path: ~/.cache/pip
42 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
43 restore-keys: |
44 ${{ runner.os }}-pip-
45 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053046
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053047 - name: Cache node modules
48 uses: actions/cache@v2
49 env:
50 cache-name: cache-node-modules
51 with:
52 path: ~/.npm
53 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
54 restore-keys: |
55 ${{ runner.os }}-build-${{ env.cache-name }}-
56 ${{ runner.os }}-build-
57 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053058
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053059 - name: Get yarn cache directory path
60 id: yarn-cache-dir-path
61 run: echo "::set-output name=dir::$(yarn cache dir)"
62
63 - uses: actions/cache@v2
64 id: yarn-cache
65 with:
66 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
67 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
68 restore-keys: |
69 ${{ runner.os }}-yarn-
70
71 - name: Install
72 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
73
74 - name: Run Tests
Suraj Shetty7044bcf2021-05-09 11:29:00 +053075 run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --use-orchestrator --with-coverage
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053076 env:
Suraj Shetty490aed22021-05-08 00:04:34 +053077 TYPE: server
Suraj Shetty7044bcf2021-05-09 11:29:00 +053078 CI_BUILD_ID: ${{ github.run_id }}
Suraj Shetty64083672021-05-10 23:48:37 +053079 ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053080
Suraj Shetty5117cbc2021-05-07 00:32:00 +053081 - name: Upload Coverage Data
Suraj Shetty5117cbc2021-05-07 00:32:00 +053082 run: |
83 cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
84 cd ${GITHUB_WORKSPACE}
85 pip3 install coverage==5.5
86 pip3 install coveralls==3.0.1
Suraj Shettyd27e70a2021-05-08 16:02:40 +053087 coveralls
Suraj Shetty5117cbc2021-05-07 00:32:00 +053088 env:
89 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Suraj Shetty5117cbc2021-05-07 00:32:00 +053090 COVERALLS_FLAG_NAME: run-${{ matrix.container }}
Suraj Shettyd27e70a2021-05-08 16:02:40 +053091 COVERALLS_SERVICE_NAME: ${{ github.event_name == 'pull_request' && 'github' || 'github-actions' }}
Suraj Shetty5117cbc2021-05-07 00:32:00 +053092 COVERALLS_PARALLEL: true
Suraj Shettycd8ee8e2021-05-04 18:36:45 +053093
Suraj Shetty5117cbc2021-05-07 00:32:00 +053094 coveralls:
95 name: Coverage Wrap Up
96 needs: test
97 container: python:3-slim
98 runs-on: ubuntu-18.04
99 steps:
100 - name: Clone
101 uses: actions/checkout@v2
102
103 - name: Coveralls Finished
104 run: |
105 cd ${GITHUB_WORKSPACE}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530106 pip3 install coverage==5.5
107 pip3 install coveralls==3.0.1
108 coveralls --finish
109 env:
110 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}