From f4b984e1383b32109cf6ad9ba42fd16133adb3c2 Mon Sep 17 00:00:00 2001 From: liangliang Date: Wed, 21 Jul 2021 21:34:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8=E6=B5=8B?= =?UTF-8?q?=E8=AF=95action,=E5=A2=9E=E5=8A=A0=E6=97=A0es=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/django.yml | 40 +++++++++++++++++++++++++++++++++++- .github/workflows/docker.yml | 6 ------ blog/documents.py | 1 + 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 0aecf02..71a51c8 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -21,8 +21,46 @@ on: - '**/*.yml' jobs: - build: + build-normal: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [ 3.6, 3.7, 3.8, 3.9 ] + + steps: + - name: Start MySQL + uses: samin/mysql-action@v1.3 + with: + host port: 3306 + container port: 3306 + character set server: utf8mb4 + collation server: utf8mb4_general_ci + mysql version: latest + mysql root password: root + mysql database: djangoblog + mysql user: root + mysql password: root + + - 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 + build-with-es: runs-on: ubuntu-latest strategy: max-parallel: 4 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 20d2423..b1f34e3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,10 +28,4 @@ jobs: with: context: . push: true - platforms: | - linux/amd64 - linux/arm64 - linux/arm/v7 - linux/arm/v6 - linux/386 tags: ${{ secrets.DOCKERHUB_USERNAME }}/djangoblog:latest diff --git a/blog/documents.py b/blog/documents.py index 5b20d0b..1901e2c 100644 --- a/blog/documents.py +++ b/blog/documents.py @@ -109,6 +109,7 @@ class ElaspedTimeDocumentManager: @staticmethod def create(url, time_taken, log_datetime, useragent, ip): + ElaspedTimeDocumentManager.build_index() ua = UserAgent() ua.browser = UserAgentBrowser() ua.browser.Family = useragent.browser.family