55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
name: Test
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
test:
|
|
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
|
|
- name: Upload coverage to Coveralls
|
|
if: github.event_name == 'push'
|
|
env:
|
|
COVERALLS_PARALLEL: true
|
|
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
|
run: |
|
|
python -m pip install coveralls
|
|
python -m coveralls
|
|
|
|
coveralls-finish:
|
|
needs: test
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.x
|
|
- name: Install Coveralls
|
|
run: python -m pip install coveralls
|
|
- name: Call Coveralls parallel builds webhook
|
|
shell: python
|
|
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')
|