Github Action学习-Django自动化测试

Github Action学习-Django自动化测试,第1张

首先现在GitHub action里面写一个workflow




在这里进行配置

注意,如果你想模拟一个数据库环境的话,那么你就在你的workflow里面加上
    - name: Setup MySQL
      uses: mirromutth/mysql-action@v1.1
      with:
        host port: 3306
        # The port of container
        container port: 3306
        # --character-set-server - The character set of MySQL server
        character set server: utf8mb4
        # --collation-server - The character collation of MySQL server
        collation server: utf8mb4_general_ci
        # Version of MySQL to use
        mysql version: 5.7#假如你的nysql版本号不一样的话可以修改
        # MYSQL_ROOT_PASSWORD - root superuser password
        mysql root password: 20010831 
        # MYSQL_DATABASE - name for the default database that is created
        mysql database: takeout_sql_1
        # MYSQL_USER - create the specified user with superuser power for created database
        mysql user: luyahu
        # MYSQL_PASSWORD - specified superuser password which user is power for created database
        mysql password: 20010831 

接下来的requirements.txt,如果你的requirements.txt里面依赖过多的话,可以试试我的
因为依赖过多会有障碍

antlr4-python3-runtime==4.10
asgiref==3.5.0
Django==3.2.13
mysqlclient==2.1.0
Pillow==9.0.1
simplejson==3.17.6
sqlparse==0.4.2
tzdata==2021.5
PyMySQL==1.0.2
#注意,以上最好符合你的版本号来

这些调通之后应该就可以了,其他的最好还是按照官方文档来

#附上官方地址
https://docs.github.com/cn/actions/automating-builds-and-tests/building-and-testing-nodejs-or-python?langId=py

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/922803.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-16
下一篇2022-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存