Skip to content

Commit

Permalink
Migrate to GitHub Actions. (jazzband#460)
Browse files Browse the repository at this point in the history
* Add GitHub Actions test workflow.

* Add database to text matrix and cleanup.

* Add 3.9.

* Write coverage XML.

* Reduce matrix again.

* Add 3.9 for realz.

* Remove pinned dependency.

* Got rid of Travis cruft.

* pydot instead of pydotplus?

* Remove need for mock package.

* Fix typo.

* Remove version pinning for test requirements.

* Remove testing on PyPy3 for time reasons.

* Add release workflow.

* No need to cache in release.

* Fix supported versions.

* No need to build universal wheel files.

* Move docker-compose file to correct spot.

* Fix docker-compose file.

* Fix directory.

* Remove docker files since it's not fully working anyway.
  • Loading branch information
jezdez authored Jan 30, 2021
1 parent 8d9b48b commit bef36dc
Show file tree
Hide file tree
Showing 27 changed files with 209 additions and 240 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
tags:
- '*'

jobs:
build:
if: github.repository == 'jazzband/django-silk'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools twine wheel
- name: Build package
run: |
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
twine check dist/*
- name: Upload packages to Jazzband
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: jazzband
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}
repository_url: https://jazzband.co/projects/django-silk/upload
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test

on: [push, pull_request]

jobs:
build:
name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9']
django-version: ['2.2', '3.0', '3.1', 'dev']

services:
postgres:
image: postgres:10
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mariadb:
image: mariadb:10.3
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: mysql
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306

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('**/requirements.txt') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }}
restore-keys: |
${{ matrix.python-version }}-v1-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: |
tox -v
env:
DJANGO: ${{ matrix.django-version }}

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## Unreleased

- Move CI to GitHub Actions. [\#460](https://github.com/jazzband/django-silk/pull/432) ([jezdez](https://github.com/jezdez))

## [4.1.0](https://github.com/jazzband/django-silk/tree/4.1.0) (2020-08-07)

[Full Changelog](https://github.com/jazzband/django-silk/compare/4.0.1...4.1.0)
Expand Down
20 changes: 0 additions & 20 deletions Dockerfile

This file was deleted.

13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Silk

[![TravisCI Build](https://img.shields.io/travis/jazzband/django-silk/master.svg)](https://travis-ci.org/jazzband/django-silk)
[![GitHub Actions](https://github.com/jazzband/django-silk/workflows/Test/badge.svg)](https://github.com/jazzband/django-silk/actions)
[![GitHub Actions](https://codecov.io/gh/jazzband/django-silk/branch/master/graph/badge.svg)](https://codecov.io/gh/jazzband/django-silk)
[![PyPI Download](https://img.shields.io/pypi/v/django-silk.svg)](https://pypi.python.org/pypi/django-silk)
[![PyPI Python Versions](https://img.shields.io/pypi/pyversions/django-silk.svg)](https://pypi.python.org/pypi/django-silk)
[![Jazzband](https://jazzband.co/static/img/badge.svg)](https://jazzband.co/)
Expand Down Expand Up @@ -30,8 +31,8 @@ Silk is a live profiling and inspection tool for the Django framework. Silk inte

Silk has been tested with:

* Django: 1.11, 2.2, 3.0, 3.1
* Python: 3.5, 3.6, 3.7, 3.8
* Django: 2.2, 3.0, 3.1
* Python: 3.6, 3.7, 3.8, 3.9

## Installation

Expand Down Expand Up @@ -523,14 +524,14 @@ pip install -e .
At this point your virtual environment should have everything it needs to run both the sample `project` and
`silk` successfully.

Before running, you must set the `DB` and `DB_NAME` environment variables:
Before running, you must set the `DB_ENGINE` and `DB_NAME` environment variables:

```bash
export DB=sqlite3
export DB_ENGINE=sqlite3
export DB_NAME=db.sqlite3
```

For other combinations, check [`.travis.yml`](./.travis.yml).
For other combinations, check [`tox.ini`](./tox.ini).

Now from the root of the sample `project` apply the migrations

Expand Down
13 changes: 0 additions & 13 deletions docker/docker-compose.yml

This file was deleted.

16 changes: 9 additions & 7 deletions project/project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@

WSGI_APPLICATION = 'wsgi.application'

DB = os.environ['DB']
if DB == 'postgresql':
DB = 'postgresql_psycopg2'
DB_ENGINE = os.environ.get("DB_ENGINE", "postgresql")

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.' + DB,
'NAME': os.environ['DB_NAME']
}
"default": {
"ENGINE": f"django.db.backends.{DB_ENGINE}",
"NAME": os.environ.get("DB_NAME", "postgres"),
"USER": os.environ.get("DB_USER", 'postgres'),
"PASSWORD": os.environ.get("DB_PASSWORD", "postgres"),
"HOST": os.environ.get("DB_HOST", "127.0.0.1"),
"PORT": os.environ.get("DB_PORT", 5432)
},
}

LANGUAGE_CODE = 'en-us'
Expand Down
18 changes: 0 additions & 18 deletions project/requirements.txt

This file was deleted.

3 changes: 1 addition & 2 deletions project/tests/test_collector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.test import TestCase
from mock import Mock
from silk.collector import DataCollector


Expand All @@ -18,4 +17,4 @@ def test_query_registration(self):
def test_clear(self):
self.test_query_registration()
DataCollector().clear()
self.assertFalse(DataCollector().queries)
self.assertFalse(DataCollector().queries)
Loading

0 comments on commit bef36dc

Please sign in to comment.