Skip to content

Commit

Permalink
Merge pull request #219 from jsocol/gh-actions
Browse files Browse the repository at this point in the history
Add a github action to run tests and linter
  • Loading branch information
jsocol committed Jan 25, 2021
2 parents cc1c3d7 + af9ae07 commit 97edb29
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Python package

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
django: [2.2, 3.0, 3.1, master]
exclude:
- python-version: 3.5
django: 3.0
- python-version: 3.5
django: 3.1
- python-version: 3.5
django: master

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [[ ${{ matrix.django }} != master ]]; then pip install --pre -q "Django>=${{ matrix.django }},<${{ matrix.django }}.99"; fi
if [[ ${{ matrix.django }} == master ]]; then pip install https://github.com/django/django/archive/master.tar.gz; fi
pip install flake8 django-redis python3-memcached
- name: Lint with flake8
run: |
./run.sh flake8
- name: Test
run: |
./run.sh test
12 changes: 9 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,24 @@ usage() {
exit 1
}

if command -v django-admin.py; then
ENTRY=django-admin.py
else
ENTRY=django-admin
fi


case "$1" in
"test" )
shift;
echo "Django version: $(django-admin.py --version)"
django-admin.py test ratelimit "$@";;
echo "Django version: $($ENTRY --version)"
$ENTRY test ratelimit "$@";;
"flake8" )
shift;
echo "Flake8 version: $(flake8 --version)"
flake8 "$@" ratelimit/;;
"shell" )
django-admin.py shell ;;
$ENTRY shell ;;
* )
usage ;;
esac

0 comments on commit 97edb29

Please sign in to comment.