]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Test Suite on GitHub Actions (#907)
authorTom Christie <tom@tomchristie.com>
Fri, 24 Apr 2020 15:46:45 +0000 (16:46 +0100)
committerGitHub <noreply@github.com>
Fri, 24 Apr 2020 15:46:45 +0000 (16:46 +0100)
* Test Suite on GitHub Actions

* Add linting checks

* Update badges. Drop unused codecov, pending GitHub action support,

.github/workflows/test-suite.yml [new file with mode: 0644]
.travis.yml [deleted file]
README.md
codecov.yml [deleted file]
docs/index.md
scripts/install
scripts/test

diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml
new file mode 100644 (file)
index 0000000..e29dcaf
--- /dev/null
@@ -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"
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index 9b0efbc..0000000
+++ /dev/null
@@ -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
index 0693a5a8cf2ef72f55fb8441250e3f2e5505b815..7dffacf88f4c5cb88834c4c4c1b547f22922a73c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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">
diff --git a/codecov.yml b/codecov.yml
deleted file mode 100644 (file)
index 3920f5c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-coverage:
-    status:
-        patch:
-            default:
-                target: '100'
-        project:
-            default:
-                target: '100'
index 0f93117155aab7cabc56d14339905c39ef7e14d9..401c7a15d5f4b5ac7b19e82b348b6e808e94871a 100644 (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">
index 7e6a38f2c05953f12fd2992abe7ae0885ed3a623..65885a7208961207ed34c9659c21ac5ef0b90314 100755 (executable)
@@ -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"
 
-set -x
+REQUIREMENTS="requirements.txt"
+VENV="venv"
 
-python -m venv venv
-${PREFIX}python -m pip install -U pip
-${PREFIX}python -m pip install -r requirements.txt
+set -x
 
-set +x
+if [ -z "$GITHUB_ACTIONS" ]; then
+    "$PYTHON" -m venv "$VENV"
+    PIP="$VENV/bin/pip"
+else
+    PIP="pip"
+fi
 
-echo
-echo "Success! You can now activate your virtual environment using:"
-echo "source ${PREFIX}activate"
+"$PIP" install -r "$REQUIREMENTS"
+"$PIP" install -e .
index 6f781f7bd511af69a73819eb93ac74c831685106..6a4a752f417c4b669ec5fd839fb5f827aa1373db 100755 (executable)
@@ -7,7 +7,7 @@ fi
 
 set -x
 
-if [ -z $CI ]; then
+if [ -z $GITHUB_ACTIONS ]; then
     scripts/check
 fi