blob: 2a1db14d95c6fa27eeeea8b54dcad8b84a1d0393 [file] [log] [blame]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05301name: CI
2
3on:
4 pull_request:
5 workflow_dispatch:
6
7jobs:
8 test:
9 runs-on: ubuntu-latest
10
11 strategy:
12 fail-fast: false
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053013
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053014 matrix:
15 include:
16 - TYPE: "server"
17 JOB_NAME: "Server"
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053018 RUN_COMMAND: cd ~/frappe-bench/ && bench --site test_site run-tests --app erpnext --coverage
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053019 - TYPE: "patch"
20 JOB_NAME: "Patch"
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053021 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 +053022
23 name: ${{ matrix.JOB_NAME }}
24
25 services:
26 mysql:
27 image: mariadb:10.3
28 env:
29 MYSQL_ALLOW_EMPTY_PASSWORD: YES
30 ports:
31 - 3306:3306
32 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
33
34 steps:
35 - name: Clone
36 uses: actions/checkout@v2
37
38 - name: Setup Python
39 uses: actions/setup-python@v2
40 with:
41 python-version: 3.6
42
43 - name: Add to Hosts
44 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
45
46 - name: Cache pip
47 uses: actions/cache@v2
48 with:
49 path: ~/.cache/pip
50 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
51 restore-keys: |
52 ${{ runner.os }}-pip-
53 ${{ runner.os }}-
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053054 - name: Cache node modules
55 uses: actions/cache@v2
56 env:
57 cache-name: cache-node-modules
58 with:
59 path: ~/.npm
60 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
61 restore-keys: |
62 ${{ runner.os }}-build-${{ env.cache-name }}-
63 ${{ runner.os }}-build-
64 ${{ runner.os }}-
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053065 - name: Get yarn cache directory path
66 id: yarn-cache-dir-path
67 run: echo "::set-output name=dir::$(yarn cache dir)"
68
69 - uses: actions/cache@v2
70 id: yarn-cache
71 with:
72 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
73 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
74 restore-keys: |
75 ${{ runner.os }}-yarn-
76
77 - name: Install
78 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
79
80 - name: Run Tests
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053081 run: ${{ matrix.RUN_COMMAND }}
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053082 env:
83 TYPE: ${{ matrix.TYPE }}
84
85 - name: Coverage
86 if: matrix.TYPE == 'server'
87 run: |
88 cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
89 cd ${GITHUB_WORKSPACE}
90 pip install coveralls==2.2.0
91 pip install coverage==4.5.4
92 coveralls
93 env:
94 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95 COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +053096