102 lines
3.4 KiB
YAML
102 lines
3.4 KiB
YAML
name: Server Tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request: {}
|
|
jobs:
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
redis-cache:
|
|
image: redis:alpine
|
|
ports:
|
|
- 13000:6379
|
|
redis-queue:
|
|
image: redis:alpine
|
|
ports:
|
|
- 11000:6379
|
|
redis-socketio:
|
|
image: redis:alpine
|
|
ports:
|
|
- 12000:6379
|
|
mariadb:
|
|
image: mariadb:10.6
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: "root"
|
|
COLLATION_SERVER: "utf8mb4_unicode_ci"
|
|
ports:
|
|
- 3306:3306
|
|
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Check for valid Python & Merge Conflicts
|
|
run: |
|
|
python -m compileall -q -f "${GITHUB_WORKSPACE}"
|
|
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
|
|
then echo "Found merge conflicts"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
check-latest: true
|
|
|
|
- name: Add to Hosts
|
|
run: |
|
|
echo "127.0.0.1 lms.test" | sudo tee -a /etc/hosts
|
|
|
|
- name: Cache pip
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
${{ runner.os }}-
|
|
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v3
|
|
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 Dependencies
|
|
run: |
|
|
bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
|
|
bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
|
|
env:
|
|
BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
|
|
AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
|
|
TYPE: server
|
|
DB: ${{ matrix.db }}
|
|
|
|
- name: Run Tests
|
|
run: cd ~/frappe-bench/ && bench --site lms.test run-parallel-tests --app lms --total-builds 4 --build-number ${{ matrix.container }}
|
|
env:
|
|
SITE: lms.test
|
|
CI_BUILD_ID: ${{ github.run_id }}
|
|
BUILD_NUMBER: ${{ matrix.container }}
|
|
TOTAL_BUILDS: 2
|
|
|
|
- name: Show bench output
|
|
if: ${{ always() }}
|
|
run: cat ~/frappe-bench/bench_start.log || true
|
|
|