Test Suite on GitHub Actions (#907)

* Test Suite on GitHub Actions

* Add linting checks

* Update badges. Drop unused codecov, pending GitHub action support,
This commit is contained in:
Tom Christie 2020-04-24 16:46:45 +01:00 committed by GitHub
parent 9085582211
commit 19bf2112a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 78 deletions

29
.github/workflows/test-suite.yml vendored Normal file
View File

@ -0,0 +1,29 @@
---
name: Test Suite
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8"]
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: "scripts/install"
- name: "Run linting checks"
run: "scripts/check"
- name: "Run tests"
run: "scripts/test"

View File

@ -1,53 +0,0 @@
dist: xenial
language: python
cache: pip
branches:
only:
- master
python:
- 3.6
- 3.7
- 3.8
stages:
- check
- docs
- test
matrix:
include:
-
stage: check
python: 3.7
script: scripts/check
- stage: docs
python: 3.7
script: scripts/docs-build
- stage: test
os: windows
language: shell
python: 3.7
env:
PATH=/c/Python37:/c/Python37/Scripts:$PATH
before_install:
- choco install python --version 3.7
- python -m pip install --upgrade pip
install: pip install -r requirements.txt
script: scripts/test
fast_finish: true
allow_failures:
# FIX
# Some tests not yet resolved for Windows. (In progress)
- os: windows
script: scripts/test
after_script:
- if [ -f .coverage ]; then
python -m pip install codecov;
codecov --required;
fi

View File

@ -5,8 +5,8 @@
<p align="center"><strong>HTTPX</strong> <em>- A next-generation HTTP client for Python.</em></p>
<p align="center">
<a href="https://travis-ci.org/encode/httpx">
<img src="https://travis-ci.org/encode/httpx.svg?branch=master" alt="Build Status">
<a href="https://github.com/encode/httpx/actions">
<img src="https://github.com/encode/httpx/workflows/Test%20Suite/badge.svg" alt="Test Suite">
</a>
<a href="https://codecov.io/gh/encode/httpx">
<img src="https://codecov.io/gh/encode/httpx/branch/master/graph/badge.svg" alt="Coverage">

View File

@ -1,8 +0,0 @@
coverage:
status:
patch:
default:
target: '100'
project:
default:
target: '100'

View File

@ -10,11 +10,8 @@ HTTPX
<div align="center">
<p>
<a href="https://travis-ci.org/encode/httpx">
<img src="https://travis-ci.org/encode/httpx.svg?branch=master" alt="Build Status">
</a>
<a href="https://codecov.io/gh/encode/httpx">
<img src="https://codecov.io/gh/encode/httpx/branch/master/graph/badge.svg" alt="Coverage">
<a href="https://github.com/encode/httpx/actions">
<img src="https://github.com/encode/httpx/workflows/Test%20Suite/badge.svg" alt="Test Suite">
</a>
<a href="https://pypi.org/project/httpx/">
<img src="https://badge.fury.io/py/httpx.svg" alt="Package version">

View File

@ -1,15 +1,19 @@
#!/bin/sh -e
export PREFIX="venv/bin/"
# Use the Python executable provided from the `-p` option, or a default.
[ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3"
REQUIREMENTS="requirements.txt"
VENV="venv"
set -x
python -m venv venv
${PREFIX}python -m pip install -U pip
${PREFIX}python -m pip install -r requirements.txt
if [ -z "$GITHUB_ACTIONS" ]; then
"$PYTHON" -m venv "$VENV"
PIP="$VENV/bin/pip"
else
PIP="pip"
fi
set +x
echo
echo "Success! You can now activate your virtual environment using:"
echo "source ${PREFIX}activate"
"$PIP" install -r "$REQUIREMENTS"
"$PIP" install -e .

View File

@ -7,7 +7,7 @@ fi
set -x
if [ -z $CI ]; then
if [ -z $GITHUB_ACTIONS ]; then
scripts/check
fi