ListSerializer 支持 exclude 参数 #277
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: test | |
on: [push, pull_request] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
django-version: [django-3.2, django-4.2, django-5.0, django-pre, django-main] | |
include: | |
- python-version: "3.6" | |
django-version: django-2.2 | |
- python-version: "3.7" | |
django-version: django-2.2 | |
- python-version: "3.8" | |
django-version: django-2.2 | |
- python-version: "3.9" | |
django-version: django-2.2 | |
- python-version: "3.6" | |
django-version: django-3.2 | |
- python-version: "3.7" | |
django-version: django-3.2 | |
- python-version: "3.8" | |
django-version: django-3.2 | |
- python-version: "3.9" | |
django-version: django-3.2 | |
- python-version: "3.8" | |
django-version: django-4.2 | |
- python-version: "3.9" | |
django-version: django-4.2 | |
exclude: | |
- python-version: "3.11" | |
django-version: django-3.2 | |
- python-version: "3.12" | |
django-version: django-3.2 | |
services: | |
# oracle: | |
# image: quay.io/maksymbilenko/oracle-12c | |
# ports: | |
# - 1521:1521 | |
# options: --health-cmd "echo exit|sqlplus system/oracle@//localhost:1521/xe" --health-interval 10s --health-timeout 5s --health-retries 5 | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: django_cool | |
POSTGRES_PASSWORD: django_cool | |
POSTGRES_DB: django_cool_test | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
mysql: | |
image: mysql | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_USER: django_cool | |
MYSQL_PASSWORD: django_cool | |
MYSQL_DATABASE: django_cool_test | |
ports: | |
- 3306:3306 | |
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Check Out | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# - name: Install oracle instantclient | |
# run: | | |
# mkdir -p /opt/oracle | |
# cd /opt/oracle | |
# wget -q https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-basic-linux.x64-21.1.0.0.0.zip | |
# unzip instantclient-basic-linux.x64-21.1.0.0.0.zip | |
- name: Install dependencies | |
run: | | |
sudo apt-get install gettext libaio1 | |
python -m pip install --upgrade pip | |
pip install flake8 "isort>=5.1.0" pytest | |
pip install mysqlclient psycopg2 cx_Oracle | |
pip install pytz | |
- name: Install Django 2.2 | |
run: | | |
pip install 'Django>=2.2,<3' | |
if: matrix.django-version == 'django-2.2' | |
- name: Install Django 3.0 | |
run: | | |
pip install 'Django>=3.0,<3.1' | |
if: matrix.django-version == 'django-3.0' | |
- name: Install Django 3.1 | |
run: | | |
pip install 'Django>=3.1,<3.2' | |
if: matrix.django-version == 'django-3.1' | |
- name: Install Django 3.2 | |
run: | | |
pip install 'Django>=3.2,<4' | |
if: matrix.django-version == 'django-3.2' | |
- name: Install Django 4.0 | |
run: | | |
pip install 'django>=4,<4.1' | |
if: matrix.django-version == 'django-4.0' | |
- name: Install Django 4.1 | |
run: | | |
pip install 'django>=4.1,<4.2' | |
if: matrix.django-version == 'django-4.1' | |
- name: Install Django 4.2 | |
run: | | |
pip install 'django>=4.2,<5' | |
if: matrix.django-version == 'django-4.2' | |
- name: Install Django 5.0 | |
run: | | |
pip install 'django>=5,<5.1' | |
if: matrix.django-version == 'django-5.0' | |
- name: Install Django pre | |
run: | | |
pip install 'django' --pre | |
if: matrix.django-version == 'django-pre' | |
- name: Install Django main | |
run: | | |
pip install 'https://github.com/django/django/archive/main.tar.gz' | |
if: matrix.django-version == 'django-main' | |
- name: Install djangorestframework | |
run: | | |
pip install djangorestframework | |
- name: Lint with flake8 | |
run: | | |
flake8 cool tests | |
- name: Lint with isort | |
run: | | |
isort --check-only --diff cool tests | |
- name: Test with pytest sqlite | |
run: | | |
pytest --db sqlite | |
- name: Test with pytest postgresql | |
run: | | |
pytest --db postgresql | |
- name: Test with pytest mysql | |
run: | | |
pytest --db mysql | |
# - name: Test with pytest oracle | |
# run: | | |
# export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_1:${LD_LIBRARY_PATH} | |
# echo ${LD_LIBRARY_PATH} | |
# pytest --db oracle |