blob: df438014789ace5f5b5a84d0ca006fbcdbf42557 [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:
Sagar Voraa2252c92022-08-09 11:49:48 +000012 group: server-postgres-develop-${{ github.event_name }}-${{ github.event.number || github.event_name == 'workflow_dispatch' && github.run_id || '' }}
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:
Ankush Menat56c6a702022-06-30 11:35:45 +053024 container: [1]
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:
Ankush Menat57d08b72022-06-30 15:49:43 +053049 python-version: '3.10'
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053050
Gavin D'souzab07dd102022-07-04 11:11:14 +053051 - name: Check for valid Python & Merge Conflicts
52 run: |
53 python -m compileall -f "${GITHUB_WORKSPACE}"
54 if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
55 then echo "Found merge conflicts"
56 exit 1
57 fi
58
Ankush Menate5e00702021-08-30 12:07:11 +053059 - name: Setup Node
60 uses: actions/setup-node@v2
61 with:
62 node-version: 14
63 check-latest: true
64
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053065 - name: Add to Hosts
66 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
67
68 - name: Cache pip
69 uses: actions/cache@v2
70 with:
71 path: ~/.cache/pip
Ankush Menat20f85192022-06-29 12:23:17 +053072 key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053073 restore-keys: |
74 ${{ runner.os }}-pip-
75 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053076
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053077 - name: Cache node modules
78 uses: actions/cache@v2
79 env:
80 cache-name: cache-node-modules
81 with:
82 path: ~/.npm
83 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
84 restore-keys: |
85 ${{ runner.os }}-build-${{ env.cache-name }}-
86 ${{ runner.os }}-build-
87 ${{ runner.os }}-
Suraj Shetty490aed22021-05-08 00:04:34 +053088
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053089 - name: Get yarn cache directory path
90 id: yarn-cache-dir-path
91 run: echo "::set-output name=dir::$(yarn cache dir)"
92
93 - uses: actions/cache@v2
94 id: yarn-cache
95 with:
96 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
97 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
98 restore-keys: |
99 ${{ runner.os }}-yarn-
100
101 - name: Install
102 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
Ankush Menat92c0dcc2021-10-20 14:43:39 +0530103 env:
Conord2074b12022-01-02 12:03:10 -0600104 DB: postgres
Ankush Menat92c0dcc2021-10-20 14:43:39 +0530105 TYPE: server
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530106
107 - name: Run Tests
Conord2074b12022-01-02 12:03:10 -0600108 run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --use-orchestrator
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +0530109 env:
Suraj Shetty490aed22021-05-08 00:04:34 +0530110 TYPE: server
Suraj Shetty7044bcf2021-05-09 11:29:00 +0530111 CI_BUILD_ID: ${{ github.run_id }}
Suraj Shetty64083672021-05-10 23:48:37 +0530112 ORCHESTRATOR_URL: http://test-orchestrator.frappe.io