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,9 +1,11 @@
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
@@ -22,80 +24,74 @@ jobs:
- 12000:6379 - 12000:6379
mariadb: mariadb:
image: mariadb:10.6 image: mariadb:10.6
env:
MYSQL_ROOT_PASSWORD: "root"
COLLATION_SERVER: "utf8mb4_unicode_ci"
ports: ports:
- 3306:3306 - 3306:3306
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3 env:
MARIADB_ROOT_PASSWORD: root
MARIADB_CHARACTER_SET: utf8mb4
MARIADB_COLLATION_SERVER: utf8mb4_unicode_ci
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps: steps:
- name: Clone - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v2
- name: Setup Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v2
with: with:
python-version: "3.11" python-version: '3.11'
- name: Check for valid Python & Merge Conflicts - name: Set up Node
run: | uses: actions/setup-node@v2
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: with:
node-version: 18 node-version: 18
check-latest: true check-latest: true
- name: Add to Hosts - name: Cache Bench
run: | uses: actions/cache@v2
echo "127.0.0.1 lms.test" | sudo tee -a /etc/hosts
- name: Cache pip
uses: actions/cache@v3
with: with:
path: ~/.cache/pip path: ~/bench-cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }} key: ${{ runner.os }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Get yarn cache directory path - name: Install Bench
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: | run: |
bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh pip3 install frappe-bench
bash ${GITHUB_WORKSPACE}/.github/helper/install.sh which bench
env:
BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} - name: Initialize Bench
AFTER: ${{ env.GITHUB_EVENT_PATH.after }} run: |
TYPE: server if [ -d ~/bench-cache/bench.tgz ]
DB: ${{ matrix.db }} 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: Add LMS App
working-directory: /home/runner/frappe-bench
run: bench get-app lms $GITHUB_WORKSPACE
- name: Create Bench Site
working-directory: /home/runner/frappe-bench
run: bench new-site --mariadb-root-password root --admin-password admin frappe.local
- name: Install LMS App
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local install-app lms
- name: Setup Requirements
working-directory: /home/runner/frappe-bench
run: bench setup requirements --dev
- name: Allow Tests
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local set-config allow_tests true
- name: Build
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local build
- name: Run Tests - name: Run 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 run-tests --app lms
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