blob: 606002e3cdf45bab3fbe1965b7886edb311fa976 [file] [log] [blame]
Suraj Shetty490aed22021-05-08 00:04:34 +05301name: Server
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05302
Suraj Shetty97687832021-05-28 13:39:53 +05303on:
4 pull_request:
5 workflow_dispatch:
6 push:
7 branches: [ develop ]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05308
9jobs:
10 test:
Mohammad Hasnain Mohsin Rajan192ab052021-03-18 17:12:12 +053011 runs-on: ubuntu-18.04
Ankush0bb60b32021-07-29 17:15:12 +053012 timeout-minutes: 60
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053013
14 strategy:
Suraj Shetty622bf072021-05-08 13:51:34 +053015 fail-fast: false
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053016
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053017 matrix:
Suraj Shetty042118a2021-05-11 10:09:06 +053018 container: [1, 2, 3]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053019
Suraj Shetty1f025a82021-05-12 18:14:22 +053020 name: Python Unit Tests
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053021
22 services:
23 mysql:
24 image: mariadb:10.3
25 env:
26 MYSQL_ALLOW_EMPTY_PASSWORD: YES
27 ports:
28 - 3306:3306
29 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
30
31 steps:
32 - name: Clone
33 uses: actions/checkout@v2
34
35 - name: Setup Python
36 uses: actions/setup-python@v2
37 with:
Suraj Shetty28fdb2e2021-05-12 23:13:11 +053038 python-version: 3.7
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053039
40 - name: Add to Hosts
41 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
42
43 - name: Cache pip
44 uses: actions/cache@v2
45 with:
46 path: ~/.cache/pip
47 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
48 restore-keys: |
49 ${{ runner.os }}-pip-
50 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053051
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053052 - name: Cache node modules
53 uses: actions/cache@v2
54 env:
55 cache-name: cache-node-modules
56 with:
57 path: ~/.npm
58 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
59 restore-keys: |
60 ${{ runner.os }}-build-${{ env.cache-name }}-
61 ${{ runner.os }}-build-
62 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053063
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053064 - name: Get yarn cache directory path
65 id: yarn-cache-dir-path
66 run: echo "::set-output name=dir::$(yarn cache dir)"
67
68 - uses: actions/cache@v2
69 id: yarn-cache
70 with:
71 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
72 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
73 restore-keys: |
74 ${{ runner.os }}-yarn-
75
76 - name: Install
77 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
78
79 - name: Run Tests
Suraj Shetty7044bcf2021-05-09 11:29:00 +053080 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 +053081 env:
Suraj Shetty490aed22021-05-08 00:04:34 +053082 TYPE: server
Suraj Shetty7044bcf2021-05-09 11:29:00 +053083 CI_BUILD_ID: ${{ github.run_id }}
Suraj Shetty64083672021-05-10 23:48:37 +053084 ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053085
Suraj Shetty5117cbc2021-05-07 00:32:00 +053086 - name: Upload Coverage Data
Suraj Shetty5117cbc2021-05-07 00:32:00 +053087 run: |
88 cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
89 cd ${GITHUB_WORKSPACE}
90 pip3 install coverage==5.5
91 pip3 install coveralls==3.0.1
Suraj Shettyd27e70a2021-05-08 16:02:40 +053092 coveralls
Suraj Shetty5117cbc2021-05-07 00:32:00 +053093 env:
94 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Suraj Shetty5b17f332021-06-01 08:18:56 +053095 COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
Suraj Shetty5117cbc2021-05-07 00:32:00 +053096 COVERALLS_FLAG_NAME: run-${{ matrix.container }}
Suraj Shettyd27e70a2021-05-08 16:02:40 +053097 COVERALLS_SERVICE_NAME: ${{ github.event_name == 'pull_request' && 'github' || 'github-actions' }}
Suraj Shetty5117cbc2021-05-07 00:32:00 +053098 COVERALLS_PARALLEL: true
Suraj Shettycd8ee8e2021-05-04 18:36:45 +053099
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530100 coveralls:
101 name: Coverage Wrap Up
102 needs: test
103 container: python:3-slim
104 runs-on: ubuntu-18.04
105 steps:
106 - name: Clone
107 uses: actions/checkout@v2
108
109 - name: Coveralls Finished
110 run: |
111 cd ${GITHUB_WORKSPACE}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530112 pip3 install coverage==5.5
113 pip3 install coveralls==3.0.1
114 coveralls --finish
115 env:
116 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}