blob: 1e9196119edb0daaa3d8b8e0f5310f3ed25653a1 [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 Shetty490aed22021-05-08 00:04:34 +053010 fail-fast: true
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053011
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053012 matrix:
Suraj Shettyccf62492021-05-08 00:05:48 +053013 container: [1, 2, 3]
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 Shetty490aed22021-05-08 00:04:34 +053033 python-version: 3.7
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 Shettyccf62492021-05-08 00:05:48 +053075 run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --build-number ${{ matrix.container }} --total-builds 3 --with-coverage
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053076 env:
Suraj Shetty490aed22021-05-08 00:04:34 +053077 TYPE: server
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053078
Suraj Shetty5117cbc2021-05-07 00:32:00 +053079 - name: Upload Coverage Data
Suraj Shetty5117cbc2021-05-07 00:32:00 +053080 run: |
81 cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
82 cd ${GITHUB_WORKSPACE}
83 pip3 install coverage==5.5
84 pip3 install coveralls==3.0.1
85 coveralls --service=github-actions
86 env:
87 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88 COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
89 COVERALLS_FLAG_NAME: run-${{ matrix.container }}
90 COVERALLS_SERVICE_NAME: github-actions
91 COVERALLS_PARALLEL: true
Suraj Shettycd8ee8e2021-05-04 18:36:45 +053092
Suraj Shetty5117cbc2021-05-07 00:32:00 +053093 coveralls:
94 name: Coverage Wrap Up
95 needs: test
96 container: python:3-slim
97 runs-on: ubuntu-18.04
98 steps:
99 - name: Clone
100 uses: actions/checkout@v2
101
102 - name: Coveralls Finished
103 run: |
104 cd ${GITHUB_WORKSPACE}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530105 pip3 install coverage==5.5
106 pip3 install coveralls==3.0.1
107 coveralls --finish
108 env:
109 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}