From e88bd18901e7f2d10fa79b49f53bb315b4802272 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Wed, 26 May 2021 22:30:54 -0400 Subject: [PATCH] Added Django main-branch CI on cron job --- .github/workflows/ci.yml | 14 ++++++- .github/workflows/main-ci.yml | 74 +++++++++++++++++++++++++++++++++++ tox.ini | 9 ++++- 3 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/main-ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c40ba6b..7e1ac45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,11 +51,23 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ matrix.python-version }}-v1- - name: Install dependencies run: | sudo apt-get install -y libmemcached-dev zlib1g-dev python -m pip install --upgrade pip - pip install tox tox-gh-actions coveralls + python -m pip install tox tox-gh-actions coveralls - name: Tox Test run: tox env: diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml new file mode 100644 index 0000000..12d90f2 --- /dev/null +++ b/.github/workflows/main-ci.yml @@ -0,0 +1,74 @@ +name: Django Main Testing CI + +on: + schedule: + - cron: "0 2 * * *" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.6', '3.7', '3.8', '3.9'] + + services: + redis: + image: redis:6.0 + ports: + - 6379:6379 + postgres: + image: postgres + ports: + - 5432:5432 + env: + POSTGRES_USER: cachalot + POSTGRES_PASSWORD: password + POSTGRES_DB: cachalot + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + mysql: + image: mysql + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: cachalot + ports: + - 3306:3306 + memcached: + image: memcached + ports: + - 11211:11211 + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ matrix.python-version }}-v1- + - name: Install dependencies + run: | + sudo apt-get install -y libmemcached-dev zlib1g-dev + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions coveralls + - name: Tox Test + run: tox + env: + TOX_TESTENV_PASSENV: POSTGRES_PASSWORD + POSTGRES_PASSWORD: password + DJANGO: 'main' diff --git a/tox.ini b/tox.ini index 64061dd..8e3b35b 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = py{36,37,38,39}-django2.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, py{36,37,38,39}-django3.1-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, py{36,37,38,39}-django3.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, + py{36,37,38,39}-djangomain-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased}, [testenv] basepython = @@ -14,6 +15,7 @@ deps = django2.2: Django>=2.2,<2.3 django3.1: Django>=3.1,<3.2 django3.2: Django>=3.2,<3.3 + djangomain: https://github.com/django/django/archive/main.tar.gz psycopg2-binary mysqlclient django-redis @@ -37,13 +39,16 @@ setenv = commands = coverage run -a --source=cachalot ./runtests.py -[gh-actions:env] -PYTHON_VER = +[gh-actions] +python = 3.6: py36 3.7: py37 3.8: py38 3.9: py39 + +[gh-actions:env] DJANGO = 2.2: django2.2 3.1: django3.1 3.2: django3.2 + main: djangomain