From beb11f464a0e883f4d73944d3cbd617ea585dfe6 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 23 Apr 2020 16:05:05 +0100 Subject: [PATCH] github-actions-for-ci (#911) --- .github/workflows/test-suite.yml | 27 +++++++++++++++++++++++++++ .travis.yml | 19 ------------------- scripts/install | 21 ++++++++------------- 3 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/test-suite.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml new file mode 100644 index 00000000..2d323e3d --- /dev/null +++ b/.github/workflows/test-suite.yml @@ -0,0 +1,27 @@ +--- +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 tests" + run: "scripts/test" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ce5350f9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -dist: xenial -language: python - -cache: pip - -python: - - "3.6" - - "3.7" - - "3.8" - -install: - - pip install -U -r requirements.txt - -script: - - scripts/test - -after_script: - - pip install codecov - - codecov diff --git a/scripts/install b/scripts/install index 726c97ec..65885a72 100755 --- a/scripts/install +++ b/scripts/install @@ -3,22 +3,17 @@ # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" -MIN_VERSION="(3, 6)" -VERSION_OK=`"$PYTHON" -c "import sys; print(sys.version_info[0:2] >= $MIN_VERSION and '1' or '');"` - -if [ -z "$VERSION_OK" ] ; then - PYTHON_VERSION=`"$PYTHON" -c "import sys; print('%s.%s' % sys.version_info[0:2]);"` - DISP_MIN_VERSION=`"$PYTHON" -c "print('%s.%s' % $MIN_VERSION)"` - echo "ERROR: Python $PYTHON_VERSION detected, but $DISP_MIN_VERSION+ is required." - echo "Please upgrade your Python distribution to install Starlette." - exit 1 -fi - REQUIREMENTS="requirements.txt" VENV="venv" -PIP="$VENV/bin/pip" set -x -"$PYTHON" -m venv "$VENV" + +if [ -z "$GITHUB_ACTIONS" ]; then + "$PYTHON" -m venv "$VENV" + PIP="$VENV/bin/pip" +else + PIP="pip" +fi + "$PIP" install -r "$REQUIREMENTS" "$PIP" install -e .