Dev #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Back-end Test | |
on: | |
push: | |
branches: | |
- main # Adjust the branch name as needed | |
pull_request: | |
jobs: | |
check_flag: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: back_end/saolei | |
services: | |
mysql: | |
image: mysql:latest | |
env: | |
MYSQL_DATABASE: saolei | |
MYSQL_ROOT_PASSWORD: 123456 | |
options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3 | |
ports: | |
- 3306:3306 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' # Choose the Python version you want to use | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install cryptography | |
- name: Create Logs Directory | |
run: mkdir -p logs | |
- name: Run Tests | |
env: | |
DJANGO_DB_NAME: saolei | |
DJANGO_DB_USER: root | |
DJANGO_DB_PASSWORD: 123456 | |
DJANGO_DB_HOST: 127.0.0.1 | |
run: | | |
python manage.py makemigrations | |
python manage.py migrate | |
- name: Flags | |
run: python -m unittest tests.py -v | |
- name: Account Link | |
run: python manage.py test accountlink |