blob: 3a1ecd399c57055e9d0a3cc1820972f68b792e88 [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:
Ankush Menat8a6b82b2021-08-13 12:59:27 +05305 paths-ignore:
6 - '**.js'
7 - '**.md'
Suraj Shetty97687832021-05-28 13:39:53 +05308 workflow_dispatch:
9 push:
10 branches: [ develop ]
Ankush Menat8a6b82b2021-08-13 12:59:27 +053011 paths-ignore:
12 - '**.js'
13 - '**.md'
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053014
15jobs:
16 test:
Mohammad Hasnain Mohsin Rajan192ab052021-03-18 17:12:12 +053017 runs-on: ubuntu-18.04
Ankush0bb60b32021-07-29 17:15:12 +053018 timeout-minutes: 60
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053019
20 strategy:
Suraj Shetty622bf072021-05-08 13:51:34 +053021 fail-fast: false
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053022
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053023 matrix:
Suraj Shetty042118a2021-05-11 10:09:06 +053024 container: [1, 2, 3]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053025
Suraj Shetty1f025a82021-05-12 18:14:22 +053026 name: Python Unit Tests
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053027
28 services:
29 mysql:
30 image: mariadb:10.3
31 env:
32 MYSQL_ALLOW_EMPTY_PASSWORD: YES
33 ports:
34 - 3306:3306
35 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
36
37 steps:
38 - name: Clone
39 uses: actions/checkout@v2
40
41 - name: Setup Python
42 uses: actions/setup-python@v2
43 with:
Suraj Shetty28fdb2e2021-05-12 23:13:11 +053044 python-version: 3.7
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053045
46 - name: Add to Hosts
47 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
48
49 - name: Cache pip
50 uses: actions/cache@v2
51 with:
52 path: ~/.cache/pip
53 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
54 restore-keys: |
55 ${{ runner.os }}-pip-
56 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053057
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053058 - 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 }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053069
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053070 - name: Get yarn cache directory path
71 id: yarn-cache-dir-path
72 run: echo "::set-output name=dir::$(yarn cache dir)"
73
74 - uses: actions/cache@v2
75 id: yarn-cache
76 with:
77 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
78 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
79 restore-keys: |
80 ${{ runner.os }}-yarn-
81
82 - name: Install
83 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
84
85 - name: Run Tests
Suraj Shetty7044bcf2021-05-09 11:29:00 +053086 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 +053087 env:
Suraj Shetty490aed22021-05-08 00:04:34 +053088 TYPE: server
Suraj Shetty7044bcf2021-05-09 11:29:00 +053089 CI_BUILD_ID: ${{ github.run_id }}
Suraj Shetty64083672021-05-10 23:48:37 +053090 ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053091
Suraj Shetty5117cbc2021-05-07 00:32:00 +053092 - name: Upload Coverage Data
Suraj Shetty5117cbc2021-05-07 00:32:00 +053093 run: |
94 cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
95 cd ${GITHUB_WORKSPACE}
96 pip3 install coverage==5.5
97 pip3 install coveralls==3.0.1
Suraj Shettyd27e70a2021-05-08 16:02:40 +053098 coveralls
Suraj Shetty5117cbc2021-05-07 00:32:00 +053099 env:
100 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Suraj Shetty5b17f332021-06-01 08:18:56 +0530101 COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530102 COVERALLS_FLAG_NAME: run-${{ matrix.container }}
Suraj Shettyd27e70a2021-05-08 16:02:40 +0530103 COVERALLS_SERVICE_NAME: ${{ github.event_name == 'pull_request' && 'github' || 'github-actions' }}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530104 COVERALLS_PARALLEL: true
Suraj Shettycd8ee8e2021-05-04 18:36:45 +0530105
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530106 coveralls:
107 name: Coverage Wrap Up
108 needs: test
109 container: python:3-slim
110 runs-on: ubuntu-18.04
111 steps:
112 - name: Clone
113 uses: actions/checkout@v2
114
115 - name: Coveralls Finished
116 run: |
117 cd ${GITHUB_WORKSPACE}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530118 pip3 install coverage==5.5
119 pip3 install coveralls==3.0.1
120 coveralls --finish
121 env:
122 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}