Skip to content

Commit

Permalink
Fix GitHub Actions (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Jan 28, 2022
1 parent 7893710 commit 9e7fe62
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
43 changes: 7 additions & 36 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- main
- master
pull_request:

concurrency:
Expand All @@ -12,7 +12,7 @@ concurrency:

jobs:
tests:
name: Python ${{ matrix.python-version }}
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -38,45 +38,16 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade tox tox-py
python -m pip install --upgrade tox
- name: Run tox targets for ${{ matrix.python-version }}
run: tox --py current
shell: bash
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') python -m tox
- name: Upload coverage data
uses: actions/upload-artifact@v2
with:
name: coverage-data
path: '.coverage.*'

coverage:
name: Coverage
runs-on: ubuntu-20.04
needs: tests
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: python -m pip install --upgrade coverage[toml]

- name: Download data
uses: actions/download-artifact@v2
with:
name: coverage-data

- name: Combine coverage and fail if it's <100%
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
- name: Upload HTML report
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: html-report
path: htmlcov
File renamed without changes.
11 changes: 9 additions & 2 deletions tests/django_urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
from django.conf.urls import url
import django
from django.http import HttpResponse


def hello_world(reqeust):
return HttpResponse(content="Hello Word", content_type="text/plain")


urlpatterns = [url(r"^hello$", hello_world)]
if django.VERSION >= (2, 0):
from django.urls import path

urlpatterns = [path("hello", hello_world)]
else:
from django.conf.urls import url

urlpatterns = [url(r"^hello$", hello_world)]
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ envlist =
py{36,37,38}-django30
py{36,37,38}-django31
py{36,37,38}-django32
py{36,37,38}-main

[testenv]
commands = python -m coverage run -m pytest {posargs}
Expand All @@ -17,14 +16,13 @@ setenv =
DJANGO_SETTINGS_MODULE = tests.django_settings
COVERAGE_FILE = .coverage.{envname}
deps =
-rrequirements.test.txt
-rrequirements/test.txt
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<3.0
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django32: Django>=3.2,<3.3
main: https://github.com/django/django/archive/main.tar.gz
extras =
brotli

0 comments on commit 9e7fe62

Please sign in to comment.