2022-01-02 18:03:10 +00:00
|
|
|
name: Server (Postgres)
|
2021-03-12 08:39:52 +00:00
|
|
|
|
2021-05-28 08:09:53 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
2021-08-13 07:29:27 +00:00
|
|
|
paths-ignore:
|
|
|
|
- '**.js'
|
|
|
|
- '**.md'
|
2022-01-02 18:03:10 +00:00
|
|
|
- '**.html'
|
|
|
|
types: [opened, labelled, synchronize, reopened]
|
2021-03-12 08:39:52 +00:00
|
|
|
|
2021-08-30 08:37:13 +00:00
|
|
|
concurrency:
|
2022-08-09 11:49:48 +00:00
|
|
|
group: server-postgres-develop-${{ github.event_name }}-${{ github.event.number || github.event_name == 'workflow_dispatch' && github.run_id || '' }}
|
2021-08-30 08:37:13 +00:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-03-12 08:39:52 +00:00
|
|
|
jobs:
|
|
|
|
test:
|
2022-01-02 18:03:10 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'postgres') }}
|
2021-08-30 12:54:48 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-07-29 11:45:12 +00:00
|
|
|
timeout-minutes: 60
|
2021-03-12 08:39:52 +00:00
|
|
|
|
|
|
|
strategy:
|
2021-05-08 08:21:34 +00:00
|
|
|
fail-fast: false
|
2021-03-12 08:39:52 +00:00
|
|
|
matrix:
|
2022-06-30 06:05:45 +00:00
|
|
|
container: [1]
|
2021-05-07 18:34:34 +00:00
|
|
|
|
2021-05-12 12:44:22 +00:00
|
|
|
name: Python Unit Tests
|
2021-03-12 08:39:52 +00:00
|
|
|
|
|
|
|
services:
|
2022-01-02 18:03:10 +00:00
|
|
|
postgres:
|
|
|
|
image: postgres:13.3
|
2021-03-12 08:39:52 +00:00
|
|
|
env:
|
2022-01-02 18:03:10 +00:00
|
|
|
POSTGRES_PASSWORD: travis
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
2021-03-12 08:39:52 +00:00
|
|
|
ports:
|
2022-01-02 18:03:10 +00:00
|
|
|
- 5432:5432
|
2021-03-12 08:39:52 +00:00
|
|
|
|
|
|
|
steps:
|
2022-01-02 18:03:10 +00:00
|
|
|
|
2021-03-12 08:39:52 +00:00
|
|
|
- name: Clone
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
2022-06-30 10:19:43 +00:00
|
|
|
python-version: '3.10'
|
2021-03-12 08:39:52 +00:00
|
|
|
|
2022-07-04 05:41:14 +00:00
|
|
|
- name: Check for valid Python & Merge Conflicts
|
|
|
|
run: |
|
|
|
|
python -m compileall -f "${GITHUB_WORKSPACE}"
|
|
|
|
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
|
|
|
|
then echo "Found merge conflicts"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-08-30 06:37:11 +00:00
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: 14
|
|
|
|
check-latest: true
|
|
|
|
|
2021-03-12 08:39:52 +00:00
|
|
|
- name: Add to Hosts
|
|
|
|
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
|
|
|
|
|
|
|
|
- name: Cache pip
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
2022-06-29 06:53:17 +00:00
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
|
2021-03-12 08:39:52 +00:00
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pip-
|
|
|
|
${{ runner.os }}-
|
2021-05-07 18:34:34 +00:00
|
|
|
|
2021-03-12 08:39:52 +00:00
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
${{ runner.os }}-
|
2021-05-07 18:34:34 +00:00
|
|
|
|
2021-03-12 08:39:52 +00:00
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
|
2021-10-20 09:13:39 +00:00
|
|
|
env:
|
2022-01-02 18:03:10 +00:00
|
|
|
DB: postgres
|
2021-10-20 09:13:39 +00:00
|
|
|
TYPE: server
|
2021-03-12 08:39:52 +00:00
|
|
|
|
|
|
|
- name: Run Tests
|
2022-01-02 18:03:10 +00:00
|
|
|
run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --use-orchestrator
|
2021-03-12 08:39:52 +00:00
|
|
|
env:
|
2021-05-07 18:34:34 +00:00
|
|
|
TYPE: server
|
2021-05-09 05:59:00 +00:00
|
|
|
CI_BUILD_ID: ${{ github.run_id }}
|
2021-05-10 18:18:37 +00:00
|
|
|
ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
|