|
|
|
|
@ -13,44 +13,57 @@ jobs:
|
|
|
|
|
strategy:
|
|
|
|
|
max-parallel: 4
|
|
|
|
|
matrix:
|
|
|
|
|
python-version: [3.6, 3.7, 3.8, 3.9]
|
|
|
|
|
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
|
|
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
- name: Start MySQL
|
|
|
|
|
uses: samin/mysql-action@v1.3
|
|
|
|
|
with:
|
|
|
|
|
# The port of host
|
|
|
|
|
host port: 3306 # optional, default is 3306
|
|
|
|
|
# The port of container
|
|
|
|
|
container port: 3306 # optional, default is 3306
|
|
|
|
|
# --character-set-server - The character set of MySQL server
|
|
|
|
|
character set server: utf8mb4 # optional, default is utf8mb4
|
|
|
|
|
# --collation-server - The character collation of MySQL server
|
|
|
|
|
collation server: utf8mb4_general_ci # optional, default is utf8mb4_general_ci
|
|
|
|
|
# Version of MySQL to use
|
|
|
|
|
mysql version: latest # optional, default is latest
|
|
|
|
|
# MYSQL_ROOT_PASSWORD - root superuser password
|
|
|
|
|
mysql root password: root # optional, default is
|
|
|
|
|
# MYSQL_DATABASE - name for the default database that is created
|
|
|
|
|
mysql database: djangoblog # optional, default is
|
|
|
|
|
# MYSQL_USER - create the specified user with superuser power for created database
|
|
|
|
|
mysql user: root # optional, default is
|
|
|
|
|
# MYSQL_PASSWORD - specified superuser password which user is power for created database
|
|
|
|
|
mysql password: root # optional, default is
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
|
with:
|
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
- name: Install Dependencies
|
|
|
|
|
run: |
|
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
|
pip install -r requirements.txt
|
|
|
|
|
- name: Run Tests
|
|
|
|
|
env:
|
|
|
|
|
DJANGO_MYSQL_PASSWORD: root
|
|
|
|
|
DJANGO_MYSQL_HOST: 127.0.0.1
|
|
|
|
|
run: |
|
|
|
|
|
python manage.py makemigrations
|
|
|
|
|
python manage.py migrate
|
|
|
|
|
python manage.py test
|
|
|
|
|
- name: Start MySQL
|
|
|
|
|
uses: samin/mysql-action@v1.3
|
|
|
|
|
with:
|
|
|
|
|
# The port of host
|
|
|
|
|
host port: 3306 # optional, default is 3306
|
|
|
|
|
# The port of container
|
|
|
|
|
container port: 3306 # optional, default is 3306
|
|
|
|
|
# --character-set-server - The character set of MySQL server
|
|
|
|
|
character set server: utf8mb4 # optional, default is utf8mb4
|
|
|
|
|
# --collation-server - The character collation of MySQL server
|
|
|
|
|
collation server: utf8mb4_general_ci # optional, default is utf8mb4_general_ci
|
|
|
|
|
# Version of MySQL to use
|
|
|
|
|
mysql version: latest # optional, default is latest
|
|
|
|
|
# MYSQL_ROOT_PASSWORD - root superuser password
|
|
|
|
|
mysql root password: root # optional, default is
|
|
|
|
|
# MYSQL_DATABASE - name for the default database that is created
|
|
|
|
|
mysql database: djangoblog # optional, default is
|
|
|
|
|
# MYSQL_USER - create the specified user with superuser power for created database
|
|
|
|
|
mysql user: root # optional, default is
|
|
|
|
|
# MYSQL_PASSWORD - specified superuser password which user is power for created database
|
|
|
|
|
mysql password: root # optional, default is
|
|
|
|
|
- name: Configure sysctl limits
|
|
|
|
|
run: |
|
|
|
|
|
sudo swapoff -a
|
|
|
|
|
sudo sysctl -w vm.swappiness=1
|
|
|
|
|
sudo sysctl -w fs.file-max=262144
|
|
|
|
|
sudo sysctl -w vm.max_map_count=262144
|
|
|
|
|
|
|
|
|
|
- uses: miyataka/elasticsearch-github-actions@1
|
|
|
|
|
with:
|
|
|
|
|
stack-version: '7.12.1'
|
|
|
|
|
plugins: 'https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip'
|
|
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
|
with:
|
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
- name: Install Dependencies
|
|
|
|
|
run: |
|
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
|
pip install -r requirements.txt
|
|
|
|
|
- name: Run Tests
|
|
|
|
|
env:
|
|
|
|
|
DJANGO_MYSQL_PASSWORD: root
|
|
|
|
|
DJANGO_MYSQL_HOST: 127.0.0.1
|
|
|
|
|
DJANGO_ELASTICSEARCH_HOST: 127.0.0.1:9200
|
|
|
|
|
run: |
|
|
|
|
|
python manage.py makemigrations
|
|
|
|
|
python manage.py migrate
|
|
|
|
|
python manage.py test
|
|
|
|
|
|