ci: added collation server for mariadb

This commit is contained in:
Jannat Patel
2023-10-13 15:24:12 +05:30
parent c20fa7e093
commit 12c5ad54e7

View File

@@ -1,101 +1,97 @@
name: Server Tests name: Server Tests
on: on:
push: push:
branches: branches:
- main - main
pull_request: {} pull_request: {}
jobs: jobs:
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
redis-cache: redis-cache:
image: redis:alpine image: redis:alpine
ports: ports:
- 13000:6379 - 13000:6379
redis-queue: redis-queue:
image: redis:alpine image: redis:alpine
ports: ports:
- 11000:6379 - 11000:6379
redis-socketio: redis-socketio:
image: redis:alpine image: redis:alpine
ports: ports:
- 12000:6379 - 12000:6379
mariadb: mariadb:
image: mariadb:10.6 image: mariadb:10.6
env: ports:
MYSQL_ROOT_PASSWORD: "root" - 3306:3306
COLLATION_SERVER: "utf8mb4_unicode_ci" env:
ports: MARIADB_ROOT_PASSWORD: root
- 3306:3306 MARIADB_CHARACTER_SET: utf8mb4
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3 MARIADB_COLLATION_SERVER: utf8mb4_unicode_ci
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v2
steps: - name: Set up Python
- name: Clone uses: actions/setup-python@v2
uses: actions/checkout@v4 with:
python-version: '3.11'
- name: Setup Python - name: Set up Node
uses: actions/setup-python@v4 uses: actions/setup-node@v2
with: with:
python-version: "3.11" node-version: 18
check-latest: true
- name: Check for valid Python & Merge Conflicts - name: Cache Bench
run: | uses: actions/cache@v2
python -m compileall -q -f "${GITHUB_WORKSPACE}" with:
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}" path: ~/bench-cache
then echo "Found merge conflicts" key: ${{ runner.os }}
exit 1
fi
- name: Setup Node - name: Install Bench
uses: actions/setup-node@v3 run: |
with: pip3 install frappe-bench
node-version: 18 which bench
check-latest: true
- name: Add to Hosts - name: Initialize Bench
run: | run: |
echo "127.0.0.1 lms.test" | sudo tee -a /etc/hosts if [ -d ~/bench-cache/bench.tgz ]
then
(cd && tar xzf ~/bench-cache/bench.tgz)
else
bench init ~/frappe-bench --skip-redis-config-generation --skip-assets --python "$(which python)"
mkdir -p ~/bench-cache
(cd && tar czf ~/bench-cache/bench.tgz frappe-bench)
fi
- name: Cache pip - name: Add LMS App
uses: actions/cache@v3 working-directory: /home/runner/frappe-bench
with: run: bench get-app lms $GITHUB_WORKSPACE
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 - name: Create Bench Site
id: yarn-cache-dir-path working-directory: /home/runner/frappe-bench
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT run: bench new-site --mariadb-root-password root --admin-password admin frappe.local
- uses: actions/cache@v3 - name: Install LMS App
id: yarn-cache working-directory: /home/runner/frappe-bench
with: run: bench --site frappe.local install-app lms
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies - name: Setup Requirements
run: | working-directory: /home/runner/frappe-bench
bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh run: bench setup requirements --dev
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 - name: Allow Tests
run: cd ~/frappe-bench/ && bench --site lms.test run-parallel-tests --app lms --total-builds 4 --build-number ${{ matrix.container }} working-directory: /home/runner/frappe-bench
env: run: bench --site frappe.local set-config allow_tests true
SITE: lms.test
CI_BUILD_ID: ${{ github.run_id }}
BUILD_NUMBER: ${{ matrix.container }}
TOTAL_BUILDS: 2
- name: Show bench output - name: Build
if: ${{ always() }} working-directory: /home/runner/frappe-bench
run: cat ~/frappe-bench/bench_start.log || true run: bench --site frappe.local build
- name: Run Tests
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local run-tests --app lms