Merge pull request #370 from py-thok/develop #564
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: e2e | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
workflow_dispatch: { } | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
e2e: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install ffmpeg | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: ffmpeg | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
cd hinghwa-dict-backend | |
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi | |
- name: Start django service | |
run: | | |
cd hinghwa-dict-backend | |
python3 manage.py makemigrations --merge --no-input | |
python3 manage.py migrate | |
DJANGO_SUPERUSER_PASSWORD=testtest123 python manage.py createsuperuser --username admin --email [email protected] --no-input | |
DJANGO_SUPERUSER_PASSWORD=testtest222 python manage.py createsuperuser --username admin2 --email [email protected] --no-input | |
echo -e "from django.contrib.auth.models import User\nuser=User.objects.create_user('user_test','user_test@user_test.com','123456')\nuser.set_password('123456')\nuser.save()\nexit()" | python manage.py shell | |
echo -e "from django.contrib.auth.models import User\nuser=User.objects.create_user('user_test_old_password','user_test_old_password@user_test_old_password.com','12')\nuser.set_password('12')\nuser.save()\nexit()"| python manage.py shell | |
python3 manage.py runserver & | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
- name: Install apifox cli | |
run: | | |
npm install -g apifox-cli | |
- name: Run tests | |
run: | | |
curl 127.0.0.1:8000/users/1 | |
curl 127.0.0.1:8000/users/2 | |
curl 127.0.0.1:8000/users/3 | |
curl 127.0.0.1:8000/users/4 | |
cd tests | |
for test in `ls .` | |
do | |
apifox run ${test} -r html,cli | |
done | |
- name: Kill django service | |
run: | | |
pkill -9 -f manage.py | |