Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Use Github actions as CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed Jan 13, 2021
1 parent 579c655 commit 4e4db41
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 286 deletions.
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ source = gocept.webtoken

[report]
precision = 2
fail_under = 100
# PY2 has to be back at 100 with PY3 only.
fail_under = 99

[html]
directory = coverage-report
51 changes: 51 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
type: [ "opened", "reopened", "synchronize" ]
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday
jobs:
tests:
strategy:
matrix:
config:
# [Python version, tox env]
- ["3.8", "flake8"]
- ["2.7", "py27"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["pypy3", "pypy3"]
- ["3.8", "coverage"]
runs-on: ubuntu-latest
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: tox -e ${{ matrix.config[1] }}
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gocept.webtoken
3.2 (unreleased)
----------------

- Nothing changed yet.
- Use Github actions as CI.


3.1.post1 (2020-04-08)
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ include *.py
include *.rst
include *.txt
include .coveragerc
include buildout.cfg
include pytest.ini
include tox.ini
recursive-include src/gocept/webtoken/testing/keys *
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
The gocept.webtoken distribution
================================

.. image:: https://travis-ci.com/gocept/gocept.webtoken.svg?branch=master
:target: https://travis-ci.com/gocept/gocept.webtoken
.. image:: https://github.com/gocept/gocept.webtoken/workflows/tests/badge.svg
:target: https://github.com/gocept/gocept.webtoken/actions?query=workflow%3Atests

.. image:: https://coveralls.io/repos/github/gocept/gocept.webtoken/badge.svg
:target: https://coveralls.io/github/gocept/gocept.webtoken

Expand Down
210 changes: 0 additions & 210 deletions bootstrap.py

This file was deleted.

40 changes: 0 additions & 40 deletions buildout.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
addopts = src --flake8
addopts = src
7 changes: 6 additions & 1 deletion src/gocept/webtoken/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ def create_authorization_header(token_or_dict):
token = token_or_dict['token']
else:
token = token_or_dict
return ('Authorization', 'Bearer {}'.format(token.decode('ascii')))

if not isinstance(token, str):
# PY2 jwt 2.0 (PY2 only) returns a string here
# jwt 2.0 should be required if we drop PY2 support.
token = token.decode('ascii')
return ('Authorization', 'Bearer {}'.format(token))


def extract_token(request_headers_or_authorization_header):
Expand Down
Loading

0 comments on commit 4e4db41

Please sign in to comment.