2020-02-25 17:27:25 +01:00
|
|
|
name: Test
|
2020-02-27 19:11:28 +01:00
|
|
|
on: [push, pull_request]
|
2020-02-25 17:27:25 +01:00
|
|
|
|
|
|
|
jobs:
|
2020-02-25 22:08:48 +01:00
|
|
|
test:
|
2020-02-25 17:27:25 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
python-version: [3.5, 3.6, 3.7, 3.8, pypy3]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install from source
|
|
|
|
run: python -m pip install --editable .[test,bcrypt]
|
|
|
|
- name: Run tests
|
|
|
|
run: python setup.py test
|
2020-02-25 22:08:48 +01:00
|
|
|
- name: Upload coverage to Coveralls
|
2020-02-25 22:37:26 +01:00
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
2020-02-25 19:32:50 +01:00
|
|
|
env:
|
|
|
|
COVERALLS_PARALLEL: true
|
|
|
|
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
|
|
|
run: |
|
|
|
|
python -m pip install coveralls
|
|
|
|
python -m coveralls
|
2020-02-25 22:08:48 +01:00
|
|
|
|
2020-03-01 00:25:41 +01:00
|
|
|
coveralls-finish:
|
2020-02-25 22:08:48 +01:00
|
|
|
needs: test
|
2020-02-25 22:37:26 +01:00
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
2020-02-25 22:08:48 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-02-29 20:33:44 +01:00
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: 3.x
|
2020-02-25 22:08:48 +01:00
|
|
|
- name: Install Coveralls
|
2020-02-29 20:33:44 +01:00
|
|
|
run: python -m pip install coveralls
|
2020-02-25 22:08:48 +01:00
|
|
|
- name: Call Coveralls parallel builds webhook
|
2020-02-29 20:33:44 +01:00
|
|
|
shell: python
|
2020-02-25 22:08:48 +01:00
|
|
|
env:
|
|
|
|
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
|
|
|
run: |
|
|
|
|
import json, os, sys
|
|
|
|
from urllib.request import Request, urlopen
|
|
|
|
from coveralls import Coveralls
|
|
|
|
_, job, _ = Coveralls.load_config_from_github()
|
|
|
|
data = json.dumps({'repo_token': os.environ.get('COVERALLS_REPO_TOKEN', ''),
|
|
|
|
'payload': {'status': 'done', 'build_num': job}}).encode()
|
|
|
|
headers = {'Content-type': 'application/json'}
|
|
|
|
with urlopen(Request('https://coveralls.io/webhook', data, headers)) as f:
|
|
|
|
sys.stderr.buffer.write(f.read() + b'\n')
|