Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 1 | name: Server (Postgres) |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 2 | |
Suraj Shetty | 9768783 | 2021-05-28 13:39:53 +0530 | [diff] [blame] | 3 | on: |
| 4 | pull_request: |
Ankush Menat | 8a6b82b | 2021-08-13 12:59:27 +0530 | [diff] [blame] | 5 | paths-ignore: |
| 6 | - '**.js' |
| 7 | - '**.md' |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 8 | - '**.html' |
| 9 | types: [opened, labelled, synchronize, reopened] |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 10 | |
Ankush Menat | 9de0f75 | 2021-08-30 14:07:13 +0530 | [diff] [blame] | 11 | concurrency: |
Sagar Vora | a2252c9 | 2022-08-09 11:49:48 +0000 | [diff] [blame] | 12 | group: server-postgres-develop-${{ github.event_name }}-${{ github.event.number || github.event_name == 'workflow_dispatch' && github.run_id || '' }} |
Ankush Menat | 9de0f75 | 2021-08-30 14:07:13 +0530 | [diff] [blame] | 13 | cancel-in-progress: true |
| 14 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 15 | jobs: |
| 16 | test: |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 17 | if: ${{ contains(github.event.pull_request.labels.*.name, 'postgres') }} |
Ankush Menat | 602374a | 2021-08-30 18:24:48 +0530 | [diff] [blame] | 18 | runs-on: ubuntu-latest |
Ankush | 0bb60b3 | 2021-07-29 17:15:12 +0530 | [diff] [blame] | 19 | timeout-minutes: 60 |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 20 | |
| 21 | strategy: |
Suraj Shetty | 622bf07 | 2021-05-08 13:51:34 +0530 | [diff] [blame] | 22 | fail-fast: false |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 23 | matrix: |
Ankush Menat | 56c6a70 | 2022-06-30 11:35:45 +0530 | [diff] [blame] | 24 | container: [1] |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 25 | |
Suraj Shetty | 1f025a8 | 2021-05-12 18:14:22 +0530 | [diff] [blame] | 26 | name: Python Unit Tests |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 27 | |
| 28 | services: |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 29 | postgres: |
| 30 | image: postgres:13.3 |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 31 | env: |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 32 | 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 Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 38 | ports: |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 39 | - 5432:5432 |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 40 | |
| 41 | steps: |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 42 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 43 | - name: Clone |
| 44 | uses: actions/checkout@v2 |
| 45 | |
| 46 | - name: Setup Python |
| 47 | uses: actions/setup-python@v2 |
| 48 | with: |
Ankush Menat | 57d08b7 | 2022-06-30 15:49:43 +0530 | [diff] [blame] | 49 | python-version: '3.10' |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 50 | |
Gavin D'souza | b07dd10 | 2022-07-04 11:11:14 +0530 | [diff] [blame] | 51 | - 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 Menat | e5e0070 | 2021-08-30 12:07:11 +0530 | [diff] [blame] | 59 | - name: Setup Node |
| 60 | uses: actions/setup-node@v2 |
| 61 | with: |
| 62 | node-version: 14 |
| 63 | check-latest: true |
| 64 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 65 | - 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 Menat | 20f8519 | 2022-06-29 12:23:17 +0530 | [diff] [blame] | 72 | key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }} |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 73 | restore-keys: | |
| 74 | ${{ runner.os }}-pip- |
| 75 | ${{ runner.os }}- |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 76 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 77 | - 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 Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 88 | |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 89 | - 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 Menat | 92c0dcc | 2021-10-20 14:43:39 +0530 | [diff] [blame] | 103 | env: |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 104 | DB: postgres |
Ankush Menat | 92c0dcc | 2021-10-20 14:43:39 +0530 | [diff] [blame] | 105 | TYPE: server |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 106 | |
| 107 | - name: Run Tests |
Conor | d2074b1 | 2022-01-02 12:03:10 -0600 | [diff] [blame] | 108 | run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --use-orchestrator |
Mohammad Hasnain Mohsin Rajan | 0f60f08 | 2021-03-12 14:09:52 +0530 | [diff] [blame] | 109 | env: |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 110 | TYPE: server |
Suraj Shetty | 7044bcf | 2021-05-09 11:29:00 +0530 | [diff] [blame] | 111 | CI_BUILD_ID: ${{ github.run_id }} |
Suraj Shetty | 6408367 | 2021-05-10 23:48:37 +0530 | [diff] [blame] | 112 | ORCHESTRATOR_URL: http://test-orchestrator.frappe.io |