blob: de8d7ac503fe194a641d65dc33546ed3c484c1a7 [file] [log] [blame]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05301name: CI
2
Sagar Vorac647b602021-03-17 20:04:59 +05303on: [pull_request, workflow_dispatch, push]
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:
10 fail-fast: false
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053011
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053012 matrix:
13 include:
14 - TYPE: "server"
15 JOB_NAME: "Server"
Suraj Shetty591f3f02021-05-04 18:36:45 +053016 RUN_COMMAND: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --with-coverage --ci-build-id $GITHUB_RUN_ID --app erpnext
17 - TYPE: "server"
18 JOB_NAME: "Server"
19 RUN_COMMAND: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --with-coverage --ci-build-id $GITHUB_RUN_ID --app erpnext
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053020 - TYPE: "patch"
21 JOB_NAME: "Patch"
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053022 RUN_COMMAND: cd ~/frappe-bench/ && wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz && bench --site test_site --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz && bench --site test_site migrate
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053023
24 name: ${{ matrix.JOB_NAME }}
25
26 services:
27 mysql:
28 image: mariadb:10.3
29 env:
30 MYSQL_ALLOW_EMPTY_PASSWORD: YES
31 ports:
32 - 3306:3306
33 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
34
35 steps:
36 - name: Clone
37 uses: actions/checkout@v2
38
39 - name: Setup Python
40 uses: actions/setup-python@v2
41 with:
42 python-version: 3.6
43
44 - name: Add to Hosts
45 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
46
47 - name: Cache pip
48 uses: actions/cache@v2
49 with:
50 path: ~/.cache/pip
51 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
52 restore-keys: |
53 ${{ runner.os }}-pip-
54 ${{ runner.os }}-
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053055 - name: Cache node modules
56 uses: actions/cache@v2
57 env:
58 cache-name: cache-node-modules
59 with:
60 path: ~/.npm
61 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
62 restore-keys: |
63 ${{ runner.os }}-build-${{ env.cache-name }}-
64 ${{ runner.os }}-build-
65 ${{ runner.os }}-
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053066 - name: Get yarn cache directory path
67 id: yarn-cache-dir-path
68 run: echo "::set-output name=dir::$(yarn cache dir)"
69
70 - uses: actions/cache@v2
71 id: yarn-cache
72 with:
73 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
74 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
75 restore-keys: |
76 ${{ runner.os }}-yarn-
77
78 - name: Install
79 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
80
81 - name: Run Tests
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053082 run: ${{ matrix.RUN_COMMAND }}
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053083 env:
84 TYPE: ${{ matrix.TYPE }}
85
Suraj Shetty591f3f02021-05-04 18:36:45 +053086 # - name: Coverage - Pull Request
87 # if: matrix.TYPE == 'server' && github.event_name == 'pull_request'
88 # run: |
89 # cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
90 # cd ${GITHUB_WORKSPACE}
91 # pip install coveralls==2.2.0
92 # pip install coverage==4.5.4
93 # coveralls --service=github
94 # env:
95 # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
97 # COVERALLS_SERVICE_NAME: github
98
99 # - name: Coverage - Push
100 # if: matrix.TYPE == 'server' && github.event_name == 'push'
101 # run: |
102 # cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
103 # cd ${GITHUB_WORKSPACE}
104 # pip install coveralls==2.2.0
105 # pip install coverage==4.5.4
106 # coveralls --service=github-actions
107 # env:
108 # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
110 # COVERALLS_SERVICE_NAME: github-actions
Mohammad Hasnain Mohsin Rajan0dc00212021-04-29 15:21:16 +0530111