2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-06 23:44:03 +00:00

ci: Migrate tests from Travis to GHA

This commit is contained in:
Gavin D'souza 2022-08-01 14:25:04 +05:30
parent 1a062263cf
commit e7c0c264d9
2 changed files with 123 additions and 60 deletions

123
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,123 @@
name: 'CI'
on:
pull_request:
workflow_dispatch:
push:
branches: [ develop ]
permissions:
contents: read
jobs:
base_setup:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
name: Base (${{ matrix.python-version }})
services:
mariadb:
image: mariadb:10.6
env:
MARIADB_ROOT_PASSWORD: travis
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v3
with:
node-version: 14
- run: |
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb;
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb;
sudo apt install redis-server
python -m pip install -U --no-cache-dir --force-reinstall urllib3 pyOpenSSL ndg-httpsclient pyasn1 wheel setuptools pip;
python -m pip install -U -e ${GITHUB_WORKSPACE};
- run: python ${GITHUB_WORKSPACE}/bench/tests/test_init.py TestBenchInit.basic
production_setup:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
python-version: [ '3.7', '3.10' ]
name: Production (${{ matrix.python-version }})
services:
mariadb:
image: mariadb:10.6
env:
MARIADB_ROOT_PASSWORD: travis
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v3
with:
node-version: 14
- run: |
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb;
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb;
sudo apt install redis-server
python -m pip install -U --no-cache-dir --force-reinstall urllib3 pyOpenSSL ndg-httpsclient pyasn1 wheel setuptools pip;
python -m pip install -U -e ${GITHUB_WORKSPACE};
- run: python bench/tests/test_setup_production.py TestSetupProduction.production
tests:
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [base_setup]
strategy:
matrix:
python-version: [ '3.7', '3.10' ]
name: Tests (${{ matrix.python-version }})
services:
mariadb:
image: mariadb:10.6
env:
MARIADB_ROOT_PASSWORD: travis
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v3
with:
node-version: 14
- run: |
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb;
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb;
sudo apt install redis-server
python -m pip install -U --no-cache-dir --force-reinstall urllib3 pyOpenSSL ndg-httpsclient pyasn1 wheel setuptools pip;
python -m pip install -U -e ${GITHUB_WORKSPACE};
- run: python -m unittest -v bench.tests.test_utils && python -m unittest -v bench.tests.test_init

View File

@ -1,60 +0,0 @@
language: python
dist: focal
sudo: true
git:
depth: 1
addons:
mariadb: '10.6'
matrix:
include:
- name: "Python 3.7 Basic Setup"
python: 3.7
script: python bench/tests/test_init.py TestBenchInit.basic
- name: "Python 3.8 Basic Setup"
python: 3.8
script: python bench/tests/test_init.py TestBenchInit.basic
- name: "Python 3.9 Basic Setup"
python: 3.9
script: python bench/tests/test_init.py TestBenchInit.basic
- name: "Python 3.10 Basic Setup"
python: "3.10"
script: python bench/tests/test_init.py TestBenchInit.basic
- name: "Python 3.7 Production Setup"
python: 3.7
script: python bench/tests/test_setup_production.py TestSetupProduction.production
- name: "Python 3.10 Production Setup"
python: "3.10"
script: python bench/tests/test_setup_production.py TestSetupProduction.production
- name: "Python 3.7 Tests"
python: 3.7
script: python -m unittest -v bench.tests.test_utils && python -m unittest -v bench.tests.test_init
- name: "Python 3.10 Tests"
python: "3.10"
script: python -m unittest -v bench.tests.test_utils && python -m unittest -v bench.tests.test_init
install:
- wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb;
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb;
- nvm install 14;
nvm use 14;
- mkdir -p ~/.bench;
cp -r $TRAVIS_BUILD_DIR/* ~/.bench;
python -m pip install -U --no-cache-dir --force-reinstall urllib3 pyOpenSSL ndg-httpsclient pyasn1 wheel setuptools pip;
python -m pip install -U -e ~/.bench;
- mariadb --host 127.0.0.1 --port 3306 -u root -e "UPDATE mysql.user SET Password=PASSWORD('travis') WHERE User='root'";
mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "SET GLOBAL character_set_server = 'utf8mb4'";
mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'";
mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "FLUSH PRIVILEGES";