From 44d80ec916dc974da99680d0c2c53c0f2b56daee Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 13:51:40 +0100 Subject: [PATCH 01/19] run the action on every branch --- .github/workflows/django.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index c11ebe5f..3d57b785 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -1,10 +1,6 @@ name: Test -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] jobs: build: From c0091b27ecfaee0c3813c65f19fb6e87f4f0ccc0 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 13:54:41 +0100 Subject: [PATCH 02/19] add python 3.9 --- .github/workflows/django.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 3d57b785..d2dca08c 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.6, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 From 4c4bc9ece884246952b831ca101de26524981104 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 13:55:07 +0100 Subject: [PATCH 03/19] Speedup password hashing --- .github/workflows/django.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index d2dca08c..d346ff76 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -21,6 +21,7 @@ jobs: python -m pip install --upgrade pip pip install coveralls pip install -r requirements.txt + echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> settings.py - name: Test env: PYTHONWARNINGS: all From 2875b327bea81946ee3086951e402e571cc7fcf7 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:01:52 +0100 Subject: [PATCH 04/19] Add pip cache --- .github/workflows/django.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index d346ff76..b489b920 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -16,6 +16,11 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Cache pip + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip - name: Install dependencies run: | python -m pip install --upgrade pip From 42825a527af23c31a5f2b16f383143c107be0c15 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:04:28 +0100 Subject: [PATCH 05/19] Remove duplicate test run --- .github/workflows/django.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index b489b920..3b7a4c02 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -34,7 +34,6 @@ jobs: COVERALLS_SERVICE_NAME: github run: | python src/manage.py check - python src/manage.py test feedback coverage run --omit="*/migrations*" --source="." src/manage.py test feedback coveralls From 6bb75c9d6d12a8e29a24f27cca4352e492385653 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:08:35 +0100 Subject: [PATCH 06/19] Add check for missing migrations --- .github/workflows/django.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 3b7a4c02..cd082395 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -34,6 +34,7 @@ jobs: COVERALLS_SERVICE_NAME: github run: | python src/manage.py check + python src/manage.py makemigrations --dry-run --check coverage run --omit="*/migrations*" --source="." src/manage.py test feedback coveralls From b2bf33b2ff7cb0a35154e2dc239c3d44d428ee08 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:10:14 +0100 Subject: [PATCH 07/19] Move Static Tests to own section --- .github/workflows/django.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index cd082395..db4b36e0 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -27,14 +27,19 @@ jobs: pip install coveralls pip install -r requirements.txt echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> settings.py + - name: Static Tests + env: + PYTHONWARNINGS: all + run: | + python src/manage.py check + python src/manage.py makemigrations --dry-run --check + - name: Test env: PYTHONWARNINGS: all GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_SERVICE_NAME: github run: | - python src/manage.py check - python src/manage.py makemigrations --dry-run --check coverage run --omit="*/migrations*" --source="." src/manage.py test feedback coveralls From 59d2096757ce70610f1c95e027dd082dd79e3f77 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:13:02 +0100 Subject: [PATCH 08/19] fix settings.py path --- .github/workflows/django.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index db4b36e0..332346dc 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -26,7 +26,7 @@ jobs: python -m pip install --upgrade pip pip install coveralls pip install -r requirements.txt - echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> settings.py + echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> src/settings.py - name: Static Tests env: PYTHONWARNINGS: all From 790833f8df3f93527e5db246aed0a21583bd9984 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:20:28 +0100 Subject: [PATCH 09/19] move coverage settings to .coveragerc --- .coveragerc | 12 ++++++++++++ .github/workflows/django.yml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..fb7547f9 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,12 @@ +[run] +omit = + */migrations/* + */tests.py + */tests_*.py + */tests/* + venv/* + +source = . +[report] +precision = 2 +show_missing = True diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 332346dc..2ee65fe2 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -40,6 +40,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_SERVICE_NAME: github run: | - coverage run --omit="*/migrations*" --source="." src/manage.py test feedback + coverage run src/manage.py test feedback coveralls From 4e309a5258ba47accd96650d834adaaf5536f88e Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:22:07 +0100 Subject: [PATCH 10/19] Rename Tests to Unit test --- .github/workflows/django.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 2ee65fe2..a0dc018b 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -34,7 +34,7 @@ jobs: python src/manage.py check python src/manage.py makemigrations --dry-run --check - - name: Test + - name: Unit Tests env: PYTHONWARNINGS: all GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1fdf5b5062f079dadc2c7aa689bb083fdd44010b Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:27:06 +0100 Subject: [PATCH 11/19] add wheel and setuptools --- .github/workflows/django.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index a0dc018b..366e2769 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install coveralls + pip install coveralls wheel setuptools pip install -r requirements.txt echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> src/settings.py - name: Static Tests From 52daa1fbdd2bccf1716326714152c58856c43645 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:34:22 +0100 Subject: [PATCH 12/19] use cache key as described by github to auto clean it --- .github/workflows/django.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 366e2769..10fff03f 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -20,7 +20,10 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip + key: ${{ runner.os }}-pip-{{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- - name: Install dependencies run: | python -m pip install --upgrade pip From 52fd0aff7fa228267d433d5fe79e12022f195fc0 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:34:46 +0100 Subject: [PATCH 13/19] remove wheel and setuptools since it dose not work --- .github/workflows/django.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 10fff03f..9f900507 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -27,7 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install coveralls wheel setuptools + pip install coveralls pip install -r requirements.txt echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> src/settings.py - name: Static Tests From c06a551395bf3f1e39a2ecf2f49e6e6b0a7f7da7 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:37:39 +0100 Subject: [PATCH 14/19] add python version to cache key --- .github/workflows/django.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 9f900507..0694c48b 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -20,8 +20,9 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-{{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-pip-{{ hashFiles('requirements.txt') }}-${{ matrix.python-version }} restore-keys: | + ${{ runner.os }}-pip-{{ hashFiles('requirements.txt') }} ${{ runner.os }}-pip- ${{ runner.os }}- - name: Install dependencies From 4d7cc2b2c65d13747580cccbca3fff26640c7b74 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:40:29 +0100 Subject: [PATCH 15/19] reorder cache key since changes in the hash are more common --- .github/workflows/django.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 0694c48b..9726ed5f 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -20,9 +20,9 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-{{ hashFiles('requirements.txt') }}-${{ matrix.python-version }} + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-{{ hashFiles('requirements.txt') }} restore-keys: | - ${{ runner.os }}-pip-{{ hashFiles('requirements.txt') }} + ${{ runner.os }}-pip-${{ matrix.python-version }} ${{ runner.os }}-pip- ${{ runner.os }}- - name: Install dependencies From bb222d0bc3cdef422dcf7fe901049838776dea74 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:45:57 +0100 Subject: [PATCH 16/19] Rename test cases --- .github/workflows/django.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 9726ed5f..c8a2a6bf 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -31,14 +31,14 @@ jobs: pip install coveralls pip install -r requirements.txt echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> src/settings.py - - name: Static Tests + - name: Static tests env: PYTHONWARNINGS: all run: | python src/manage.py check python src/manage.py makemigrations --dry-run --check - - name: Unit Tests + - name: Unit tests env: PYTHONWARNINGS: all GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 75138deb196fa4e492910c6525866871533cce65 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 14:50:19 +0100 Subject: [PATCH 17/19] Rename stage, name ubuntu explicate, add new lines per step --- .github/workflows/django.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index c8a2a6bf..097c3c69 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -3,9 +3,8 @@ name: Test on: [push, pull_request] jobs: - build: - - runs-on: ubuntu-latest + test: + runs-on: ubuntu-20.04 strategy: matrix: python-version: [3.6, 3.7, 3.8, 3.9] @@ -16,6 +15,7 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Cache pip uses: actions/cache@v2 with: @@ -25,12 +25,14 @@ jobs: ${{ runner.os }}-pip-${{ matrix.python-version }} ${{ runner.os }}-pip- ${{ runner.os }}- + - name: Install dependencies run: | python -m pip install --upgrade pip pip install coveralls pip install -r requirements.txt echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> src/settings.py + - name: Static tests env: PYTHONWARNINGS: all From 977f5df39fef77c9a7bcd326cad5f916b510482c Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 15:03:22 +0100 Subject: [PATCH 18/19] remove md5 password_hasher to messure speedup --- .github/workflows/django.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 097c3c69..98577893 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -31,7 +31,6 @@ jobs: python -m pip install --upgrade pip pip install coveralls pip install -r requirements.txt - echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> src/settings.py - name: Static tests env: From 12841783cd51fe8f5b6f487488868e65978c1316 Mon Sep 17 00:00:00 2001 From: ckleemann Date: Sun, 31 Jan 2021 15:09:47 +0100 Subject: [PATCH 19/19] Revert "remove md5 password_hasher to messure speedup" This reverts commit 977f5df39fef77c9a7bcd326cad5f916b510482c. --- .github/workflows/django.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 98577893..097c3c69 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -31,6 +31,7 @@ jobs: python -m pip install --upgrade pip pip install coveralls pip install -r requirements.txt + echo "PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher',]" >> src/settings.py - name: Static tests env: