Files
lms/.github/workflows/ci.yml
2023-10-13 16:07:01 +05:30

101 lines
2.6 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
ports:
- 3306:3306
env:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: dbname
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 18
check-latest: true
- name: Change MariaDB Collation
run: |
mysql -h 127.0.0.1 -P 3306 -uroot -proot -e "ALTER DATABASE dbname CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci"
- name: Cache Bench
uses: actions/cache@v2
with:
path: ~/bench-cache
key: ${{ runner.os }}
- name: Install Bench
run: |
pip3 install frappe-bench
which bench
- name: Initialize Bench
run: |
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: 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
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local run-tests --app lms