blob: 3bbf6a91f54946e09d302d552419b8851580b891 [file] [log] [blame]
Conord2074b12022-01-02 12:03:10 -06001name: Server (Postgres)
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'
Conord2074b12022-01-02 12:03:10 -06008 - '**.html'
9 types: [opened, labelled, synchronize, reopened]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053010
Ankush Menat9de0f752021-08-30 14:07:13 +053011concurrency:
Conord2074b12022-01-02 12:03:10 -060012 group: server-postgres-develop-${{ github.event.number }}
Ankush Menat9de0f752021-08-30 14:07:13 +053013 cancel-in-progress: true
14
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053015jobs:
16 test:
Conord2074b12022-01-02 12:03:10 -060017 if: ${{ contains(github.event.pull_request.labels.*.name, 'postgres') }}
Ankush Menat602374a2021-08-30 18:24:48 +053018 runs-on: ubuntu-latest
Ankush0bb60b32021-07-29 17:15:12 +053019 timeout-minutes: 60
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053020
21 strategy:
Suraj Shetty622bf072021-05-08 13:51:34 +053022 fail-fast: false
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053023 matrix:
Conord2074b12022-01-02 12:03:10 -060024 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:
Conord2074b12022-01-02 12:03:10 -060029 postgres:
30 image: postgres:13.3
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053031 env:
Conord2074b12022-01-02 12:03:10 -060032 POSTGRES_PASSWORD: travis
33 options: >-
34 --health-cmd pg_isready
35 --health-interval 10s
36 --health-timeout 5s
37 --health-retries 5
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053038 ports:
Conord2074b12022-01-02 12:03:10 -060039 - 5432:5432
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053040
41 steps:
Conord2074b12022-01-02 12:03:10 -060042
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053043 - name: Clone
44 uses: actions/checkout@v2
45
46 - name: Setup Python
47 uses: actions/setup-python@v2
48 with:
Suraj Shetty28fdb2e2021-05-12 23:13:11 +053049 python-version: 3.7
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053050
Ankush Menate5e00702021-08-30 12:07:11 +053051 - name: Setup Node
52 uses: actions/setup-node@v2
53 with:
54 node-version: 14
55 check-latest: true
56
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053057 - name: Add to Hosts
58 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
59
60 - name: Cache pip
61 uses: actions/cache@v2
62 with:
63 path: ~/.cache/pip
64 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
65 restore-keys: |
66 ${{ runner.os }}-pip-
67 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053068
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053069 - name: Cache node modules
70 uses: actions/cache@v2
71 env:
72 cache-name: cache-node-modules
73 with:
74 path: ~/.npm
75 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
76 restore-keys: |
77 ${{ runner.os }}-build-${{ env.cache-name }}-
78 ${{ runner.os }}-build-
79 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053080
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053081 - name: Get yarn cache directory path
82 id: yarn-cache-dir-path
83 run: echo "::set-output name=dir::$(yarn cache dir)"
84
85 - uses: actions/cache@v2
86 id: yarn-cache
87 with:
88 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
89 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
90 restore-keys: |
91 ${{ runner.os }}-yarn-
92
Conord2074b12022-01-02 12:03:10 -060093
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053094 - name: Install
95 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
Ankush Menat92c0dcc2021-10-20 14:43:39 +053096 env:
Conord2074b12022-01-02 12:03:10 -060097 DB: postgres
Ankush Menat92c0dcc2021-10-20 14:43:39 +053098 TYPE: server
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053099
100 - name: Run Tests
Conord2074b12022-01-02 12:03:10 -0600101 run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --use-orchestrator
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530102 env:
Suraj Shetty490aed22021-05-08 00:04:34 +0530103 TYPE: server
Suraj Shetty7044bcf2021-05-09 11:29:00 +0530104 CI_BUILD_ID: ${{ github.run_id }}
Suraj Shetty64083672021-05-10 23:48:37 +0530105 ORCHESTRATOR_URL: http://test-orchestrator.frappe.io