blob: 0a73d74d6b9840273f0f5f35d40917312c816ad9 [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
Ankush Menate5e00702021-08-30 12:07:11 +053046 - name: Setup Node
47 uses: actions/setup-node@v2
48 with:
49 node-version: 14
50 check-latest: true
51
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053052 - name: Add to Hosts
53 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
54
55 - name: Cache pip
56 uses: actions/cache@v2
57 with:
58 path: ~/.cache/pip
59 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
60 restore-keys: |
61 ${{ runner.os }}-pip-
62 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053063
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053064 - name: Cache node modules
65 uses: actions/cache@v2
66 env:
67 cache-name: cache-node-modules
68 with:
69 path: ~/.npm
70 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
71 restore-keys: |
72 ${{ runner.os }}-build-${{ env.cache-name }}-
73 ${{ runner.os }}-build-
74 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053075
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053076 - name: Get yarn cache directory path
77 id: yarn-cache-dir-path
78 run: echo "::set-output name=dir::$(yarn cache dir)"
79
80 - uses: actions/cache@v2
81 id: yarn-cache
82 with:
83 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
84 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
85 restore-keys: |
86 ${{ runner.os }}-yarn-
87
88 - name: Install
89 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
90
91 - name: Run Tests
Suraj Shetty7044bcf2021-05-09 11:29:00 +053092 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 +053093 env:
Suraj Shetty490aed22021-05-08 00:04:34 +053094 TYPE: server
Suraj Shetty7044bcf2021-05-09 11:29:00 +053095 CI_BUILD_ID: ${{ github.run_id }}
Suraj Shetty64083672021-05-10 23:48:37 +053096 ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053097
Suraj Shetty5117cbc2021-05-07 00:32:00 +053098 - name: Upload Coverage Data
Suraj Shetty5117cbc2021-05-07 00:32:00 +053099 run: |
100 cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
101 cd ${GITHUB_WORKSPACE}
102 pip3 install coverage==5.5
103 pip3 install coveralls==3.0.1
Suraj Shettyd27e70a2021-05-08 16:02:40 +0530104 coveralls
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530105 env:
106 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Suraj Shetty5b17f332021-06-01 08:18:56 +0530107 COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530108 COVERALLS_FLAG_NAME: run-${{ matrix.container }}
Suraj Shettyd27e70a2021-05-08 16:02:40 +0530109 COVERALLS_SERVICE_NAME: ${{ github.event_name == 'pull_request' && 'github' || 'github-actions' }}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530110 COVERALLS_PARALLEL: true
Suraj Shettycd8ee8e2021-05-04 18:36:45 +0530111
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530112 coveralls:
113 name: Coverage Wrap Up
114 needs: test
115 container: python:3-slim
116 runs-on: ubuntu-18.04
117 steps:
118 - name: Clone
119 uses: actions/checkout@v2
120
121 - name: Coveralls Finished
122 run: |
123 cd ${GITHUB_WORKSPACE}
Suraj Shetty5117cbc2021-05-07 00:32:00 +0530124 pip3 install coverage==5.5
125 pip3 install coveralls==3.0.1
126 coveralls --finish
127 env:
128 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}