From ff058499ad2d6555325c60417591800d1bf82ef6 Mon Sep 17 00:00:00 2001 From: euri10 Date: Thu, 28 May 2020 07:56:48 +0200 Subject: [PATCH 01/42] 1st pass on adding windows vm for CI --- .github/workflows/test-suite.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 2d323e3dd..c44160224 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -8,6 +8,23 @@ on: branches: ["master"] jobs: + tests_windows: + name: "Python ${{ matrix.python-version }}" + runs-on: "windows-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" tests: name: "Python ${{ matrix.python-version }}" runs-on: "ubuntu-latest" From a7671f72b56f7b86c27e834b444b84bdf8096683 Mon Sep 17 00:00:00 2001 From: euri10 Date: Thu, 28 May 2020 08:09:24 +0200 Subject: [PATCH 02/42] 2nd pass, was testing nothing --- .github/workflows/test-suite.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index c44160224..189242952 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -22,9 +22,18 @@ jobs: with: python-version: "${{ matrix.python-version }}" - name: "Install dependencies" - run: "scripts/install" + run: + # Prepend newly installed Python to the PATH of this build (this cannot be + # done from inside the powershell script as it would require to restart + # the parent CMD process). + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + - "python --version" + - "python -m pip install --upgrade pip" + - "python -m pip install -U click h11 wsproto==0.13.* websockets==8.*" + - "python -m pip install -U autoflake black codecov flake8 isort pytest pytest-cov requests watchgod" - name: "Run tests" - run: "scripts/test" + run: + - pytest tests: name: "Python ${{ matrix.python-version }}" runs-on: "ubuntu-latest" From 1fd49ec68cb03db5e574676dae7b2d68345aeb51 Mon Sep 17 00:00:00 2001 From: euri10 Date: Thu, 28 May 2020 08:15:45 +0200 Subject: [PATCH 03/42] No arrays --- .github/workflows/test-suite.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 189242952..b1211e64e 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -21,16 +21,19 @@ jobs: - uses: "actions/setup-python@v1" with: python-version: "${{ matrix.python-version }}" - - name: "Install dependencies" + - name: "Set PATH" run: # Prepend newly installed Python to the PATH of this build (this cannot be # done from inside the powershell script as it would require to restart # the parent CMD process). - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + - name: "Check python version" + run: - "python --version" - "python -m pip install --upgrade pip" - - "python -m pip install -U click h11 wsproto==0.13.* websockets==8.*" - - "python -m pip install -U autoflake black codecov flake8 isort pytest pytest-cov requests watchgod" + - name: "Install dependencies" + run: + - "python -m pip install -U click h11 wsproto==0.13.* websockets==8.* autoflake black codecov flake8 isort pytest pytest-cov requests watchgod" - name: "Run tests" run: - pytest From 69483adc39b928c0e5f74e86c2d7d006e1f214e2 Mon Sep 17 00:00:00 2001 From: euri10 Date: Thu, 28 May 2020 08:18:03 +0200 Subject: [PATCH 04/42] No arrays 2 --- .github/workflows/test-suite.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index b1211e64e..80c6b2e93 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -21,12 +21,12 @@ jobs: - uses: "actions/setup-python@v1" with: python-version: "${{ matrix.python-version }}" - - name: "Set PATH" - run: - # Prepend newly installed Python to the PATH of this build (this cannot be - # done from inside the powershell script as it would require to restart - # the parent CMD process). - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" +# - name: "Set PATH" +# run: +# # Prepend newly installed Python to the PATH of this build (this cannot be +# # done from inside the powershell script as it would require to restart +# # the parent CMD process). +# - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - name: "Check python version" run: - "python --version" From 2247f5de6d2fbbeb1dfc801884d332c6c0f0a7e8 Mon Sep 17 00:00:00 2001 From: euri10 Date: Thu, 28 May 2020 08:21:38 +0200 Subject: [PATCH 05/42] No arrays 3 --- .github/workflows/test-suite.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 80c6b2e93..4b477e7fd 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -21,19 +21,12 @@ jobs: - uses: "actions/setup-python@v1" with: python-version: "${{ matrix.python-version }}" -# - name: "Set PATH" -# run: -# # Prepend newly installed Python to the PATH of this build (this cannot be -# # done from inside the powershell script as it would require to restart -# # the parent CMD process). -# - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - name: "Check python version" - run: - - "python --version" - - "python -m pip install --upgrade pip" - name: "Install dependencies" - run: - - "python -m pip install -U click h11 wsproto==0.13.* websockets==8.* autoflake black codecov flake8 isort pytest pytest-cov requests watchgod" + run: | + SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH% + python --version + python -m pip install --upgrade pip + python -m pip install -U click h11 wsproto==0.13.* websockets==8.* autoflake black codecov flake8 isort pytest pytest-cov requests watchgod - name: "Run tests" run: - pytest From d8c791cd852d248ff71f4e6938accef6a0981fc4 Mon Sep 17 00:00:00 2001 From: euri10 Date: Thu, 28 May 2020 08:23:10 +0200 Subject: [PATCH 06/42] No arrays 4 --- .github/workflows/test-suite.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 4b477e7fd..737a81e24 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -28,8 +28,7 @@ jobs: python -m pip install --upgrade pip python -m pip install -U click h11 wsproto==0.13.* websockets==8.* autoflake black codecov flake8 isort pytest pytest-cov requests watchgod - name: "Run tests" - run: - - pytest + run: pytest tests: name: "Python ${{ matrix.python-version }}" runs-on: "ubuntu-latest" From 1a83b679efb1ef9ba2f66617e66d05563a3766e5 Mon Sep 17 00:00:00 2001 From: euri10 Date: Thu, 28 May 2020 08:24:52 +0200 Subject: [PATCH 07/42] Removed appveyor PATH export --- .github/workflows/test-suite.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 737a81e24..1088f9bcf 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -23,7 +23,6 @@ jobs: python-version: "${{ matrix.python-version }}" - name: "Install dependencies" run: | - SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH% python --version python -m pip install --upgrade pip python -m pip install -U click h11 wsproto==0.13.* websockets==8.* autoflake black codecov flake8 isort pytest pytest-cov requests watchgod From 942a20da548801641238519c00d7c71eb47883ae Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:12:31 +0200 Subject: [PATCH 08/42] Using scripts on windows CI, will need to write ps1 scripts --- .github/workflows/test-suite.yml | 36 ++++++++++---------------------- scripts/install | 19 ----------------- scripts/test | 14 ------------- 3 files changed, 11 insertions(+), 58 deletions(-) delete mode 100755 scripts/install delete mode 100755 scripts/test diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 1088f9bcf..a8b78b435 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -8,40 +8,26 @@ on: branches: ["master"] jobs: - tests_windows: - name: "Python ${{ matrix.python-version }}" - runs-on: "windows-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: | - python --version - python -m pip install --upgrade pip - python -m pip install -U click h11 wsproto==0.13.* websockets==8.* autoflake black codecov flake8 isort pytest pytest-cov requests watchgod - - name: "Run tests" - run: pytest tests: name: "Python ${{ matrix.python-version }}" runs-on: "ubuntu-latest" - strategy: matrix: - python-version: ["3.6", "3.7", "3.8"] - + python-version: ["3.6", "3.7", "3.8"] + os: [windows-latest, ubuntu-latest] + include: + - os: windows-latest + script_install: "scripts/install.ps1" + script_test: "scripts/test.ps1" + - os: ubuntu-latest + script_install: "scripts/install.sh" + script_test: "scripts/test.sh" steps: - uses: "actions/checkout@v2" - uses: "actions/setup-python@v1" with: python-version: "${{ matrix.python-version }}" - name: "Install dependencies" - run: "scripts/install" + run: ${{ matrix.script_install }} - name: "Run tests" - run: "scripts/test" + run: ${{ matrix.script_test }} diff --git a/scripts/install b/scripts/install deleted file mode 100755 index 65885a720..000000000 --- a/scripts/install +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -e - -# 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 - -if [ -z "$GITHUB_ACTIONS" ]; then - "$PYTHON" -m venv "$VENV" - PIP="$VENV/bin/pip" -else - PIP="pip" -fi - -"$PIP" install -r "$REQUIREMENTS" -"$PIP" install -e . diff --git a/scripts/test b/scripts/test deleted file mode 100755 index d871a0e05..000000000 --- a/scripts/test +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -e - -export PREFIX="" -if [ -d 'venv' ] ; then - export PREFIX="venv/bin/" -fi - -set -x - -PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov=uvicorn --cov=tests --cov-report=term-missing ${@} -${PREFIX}coverage html -${PREFIX}autoflake --recursive uvicorn tests -${PREFIX}flake8 uvicorn tests --ignore=W503,E203,E501,E731 -${PREFIX}black uvicorn tests --check From 3519c5475703de090604940c6cdc693882c1c9e6 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:15:17 +0200 Subject: [PATCH 09/42] Matrix indent --- .github/workflows/test-suite.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index a8b78b435..3f106b8fa 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -13,15 +13,15 @@ jobs: runs-on: "ubuntu-latest" strategy: matrix: - python-version: ["3.6", "3.7", "3.8"] - os: [windows-latest, ubuntu-latest] - include: - - os: windows-latest - script_install: "scripts/install.ps1" - script_test: "scripts/test.ps1" - - os: ubuntu-latest - script_install: "scripts/install.sh" - script_test: "scripts/test.sh" + python-version: ["3.6", "3.7", "3.8"] + os: [windows-latest, ubuntu-latest] + include: + - os: windows-latest + script_install: "scripts/install.ps1" + script_test: "scripts/test.ps1" + - os: ubuntu-latest + script_install: "scripts/install.sh" + script_test: "scripts/test.sh" steps: - uses: "actions/checkout@v2" - uses: "actions/setup-python@v1" From 007b114485e414a5aba09ec9e70ee64cced6b35e Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:18:07 +0200 Subject: [PATCH 10/42] Location of scripts --- .github/workflows/test-suite.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 3f106b8fa..0684ba084 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -17,11 +17,11 @@ jobs: os: [windows-latest, ubuntu-latest] include: - os: windows-latest - script_install: "scripts/install.ps1" - script_test: "scripts/test.ps1" + script_install: "./scripts/install.ps1" + script_test: "./scripts/test.ps1" - os: ubuntu-latest - script_install: "scripts/install.sh" - script_test: "scripts/test.sh" + script_install: "./scripts/install.sh" + script_test: "./scripts/test.sh" steps: - uses: "actions/checkout@v2" - uses: "actions/setup-python@v1" From 1c630b725dc8bf5359fff535de0033dccd57a156 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:23:57 +0200 Subject: [PATCH 11/42] Hate CI --- .github/workflows/test-suite.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 0684ba084..c2014dd88 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -17,17 +17,17 @@ jobs: os: [windows-latest, ubuntu-latest] include: - os: windows-latest - script_install: "./scripts/install.ps1" - script_test: "./scripts/test.ps1" + script_install: "scripts/install.ps1" + script_test: "scripts/test.ps1" - os: ubuntu-latest - script_install: "./scripts/install.sh" - script_test: "./scripts/test.sh" + script_install: "scripts/install.sh" + script_test: "scripts/test.sh" steps: - uses: "actions/checkout@v2" - uses: "actions/setup-python@v1" with: python-version: "${{ matrix.python-version }}" - name: "Install dependencies" - run: ${{ matrix.script_install }} + run: "${{ matrix.script_install }}" - name: "Run tests" - run: ${{ matrix.script_test }} + run: "${{ matrix.script_test }}" From 7a6291cc91e7ae470f45758cb87fcd48c6964da6 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:37:02 +0200 Subject: [PATCH 12/42] Why ps1 are ignored --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index c852266ec..83cf8519a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ uvicorn.egg-info/ venv/ htmlcov/ site/ +!/scripts/test.ps1 +!/scripts/install.ps1 From a9f25f620cb19442462697e8bedfc606961e3e9e Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:38:25 +0200 Subject: [PATCH 13/42] Adding ps1 scripts, was globally ignored --- .gitignore | 2 -- scripts/install.ps1 | 8 ++++++++ scripts/test.ps1 | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 scripts/install.ps1 create mode 100755 scripts/test.ps1 diff --git a/.gitignore b/.gitignore index 83cf8519a..c852266ec 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,3 @@ uvicorn.egg-info/ venv/ htmlcov/ site/ -!/scripts/test.ps1 -!/scripts/install.ps1 diff --git a/scripts/install.ps1 b/scripts/install.ps1 new file mode 100644 index 000000000..d768832cf --- /dev/null +++ b/scripts/install.ps1 @@ -0,0 +1,8 @@ +PYTHON="python3" +REQUIREMENTS="requirements.txt" +VENV="venv" +"$PYTHON" -m venv "$VENV" +PIP="$VENV/bin/pip" + +"$PIP" install -r "$REQUIREMENTS" +"$PIP" install -e . diff --git a/scripts/test.ps1 b/scripts/test.ps1 new file mode 100755 index 000000000..1115fb196 --- /dev/null +++ b/scripts/test.ps1 @@ -0,0 +1,6 @@ +set PREFIX="venv/bin/" +PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov=uvicorn --cov=tests --cov-report=term-missing ${@} +${PREFIX}coverage html +${PREFIX}autoflake --recursive uvicorn tests +${PREFIX}flake8 uvicorn tests --ignore=W503,E203,E501,E731 +${PREFIX}black uvicorn tests --check From 0e4d199d9447faf318844767a7828a33ad0cdac6 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:41:15 +0200 Subject: [PATCH 14/42] Chmod +x ps1 --- scripts/install.ps1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/install.ps1 diff --git a/scripts/install.ps1 b/scripts/install.ps1 old mode 100644 new mode 100755 From 23efd524680b6bb0b60d4e793d8604a107e07206 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:50:16 +0200 Subject: [PATCH 15/42] Removing uvloop from win reqs --- requirements_windows.txt | 24 ++++++++++++++++++++++++ scripts/install.ps1 | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 requirements_windows.txt diff --git a/requirements_windows.txt b/requirements_windows.txt new file mode 100644 index 000000000..eeca7aa0d --- /dev/null +++ b/requirements_windows.txt @@ -0,0 +1,24 @@ +click +h11 + +# Optional +httptools +websockets==8.* +wsproto==0.13.* + +# Testing +autoflake +black +codecov +flake8 +isort +pytest +pytest-cov +requests + +# Documentation +mkdocs +mkdocs-material + +# Efficient debug reload +watchgod>=0.6,<0.7 diff --git a/scripts/install.ps1 b/scripts/install.ps1 index d768832cf..35a2339fb 100755 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -1,5 +1,5 @@ PYTHON="python3" -REQUIREMENTS="requirements.txt" +REQUIREMENTS="requirements_windows.txt" VENV="venv" "$PYTHON" -m venv "$VENV" PIP="$VENV/bin/pip" From bf05a8756c34c4c4851068d37b73a09a6306d4c4 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:52:05 +0200 Subject: [PATCH 16/42] Added install and test.sh scripts, globally ignored wtf --- scripts/install.sh | 19 +++++++++++++++++++ scripts/test.sh | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 scripts/install.sh create mode 100755 scripts/test.sh diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 000000000..65885a720 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,19 @@ +#!/bin/sh -e + +# 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 + +if [ -z "$GITHUB_ACTIONS" ]; then + "$PYTHON" -m venv "$VENV" + PIP="$VENV/bin/pip" +else + PIP="pip" +fi + +"$PIP" install -r "$REQUIREMENTS" +"$PIP" install -e . diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 000000000..d871a0e05 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,14 @@ +#!/bin/sh -e + +export PREFIX="" +if [ -d 'venv' ] ; then + export PREFIX="venv/bin/" +fi + +set -x + +PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov=uvicorn --cov=tests --cov-report=term-missing ${@} +${PREFIX}coverage html +${PREFIX}autoflake --recursive uvicorn tests +${PREFIX}flake8 uvicorn tests --ignore=W503,E203,E501,E731 +${PREFIX}black uvicorn tests --check From a1e4587690ed8a1eb78a9638edf04a3b5650f8ea Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 16:54:09 +0200 Subject: [PATCH 17/42] Align win reqs to old .travis file --- requirements_windows.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/requirements_windows.txt b/requirements_windows.txt index eeca7aa0d..486c96046 100644 --- a/requirements_windows.txt +++ b/requirements_windows.txt @@ -2,7 +2,6 @@ click h11 # Optional -httptools websockets==8.* wsproto==0.13.* @@ -16,9 +15,5 @@ pytest pytest-cov requests -# Documentation -mkdocs -mkdocs-material - # Efficient debug reload watchgod>=0.6,<0.7 From 8998fd71c53fe65267a93794e6d94082eca25c05 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 17:00:30 +0200 Subject: [PATCH 18/42] Run really on windows ? --- .github/workflows/test-suite.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index c2014dd88..036cca7db 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -9,8 +9,7 @@ on: jobs: tests: - name: "Python ${{ matrix.python-version }}" - runs-on: "ubuntu-latest" + name: "Python ${{ matrix.python-version }} ${{ matrix.os }}" strategy: matrix: python-version: ["3.6", "3.7", "3.8"] From 69c4555f99a51dff2ffe395c6a451f256f141bb3 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 17:06:09 +0200 Subject: [PATCH 19/42] Lost in matrix.... --- .github/workflows/test-suite.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 036cca7db..4b7ade8f1 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -10,6 +10,7 @@ on: jobs: tests: name: "Python ${{ matrix.python-version }} ${{ matrix.os }}" + runs-on: "${{ matrix.os }}" strategy: matrix: python-version: ["3.6", "3.7", "3.8"] From 740d4c1af1799fb4e1cfde3b3e8170c3a334f864 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 17:12:52 +0200 Subject: [PATCH 20/42] Blind ps1 --- scripts/install.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 35a2339fb..9990a6b8c 100755 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -1,8 +1,7 @@ -PYTHON="python3" REQUIREMENTS="requirements_windows.txt" VENV="venv" -"$PYTHON" -m venv "$VENV" -PIP="$VENV/bin/pip" +python3 -m venv "$VENV" +PIP="$VENV\bin\pip" "$PIP" install -r "$REQUIREMENTS" "$PIP" install -e . From 2efe2f1aaebc46400e7f06072beda61cc5025ad9 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 17:15:23 +0200 Subject: [PATCH 21/42] Blind ps1 2nd pass --- scripts/install.ps1 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 9990a6b8c..e9671c619 100755 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -1,7 +1,3 @@ REQUIREMENTS="requirements_windows.txt" -VENV="venv" -python3 -m venv "$VENV" -PIP="$VENV\bin\pip" - -"$PIP" install -r "$REQUIREMENTS" -"$PIP" install -e . +pip install -r "$REQUIREMENTS" +pip install -e . From 60f4203050c4a0c4763aa6a9a7b9d93af82fbf63 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 17:18:58 +0200 Subject: [PATCH 22/42] Blind ps1 3rd pass --- scripts/install.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install.ps1 b/scripts/install.ps1 index e9671c619..e35f7ec07 100755 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -1,3 +1,2 @@ -REQUIREMENTS="requirements_windows.txt" -pip install -r "$REQUIREMENTS" +pip install -r requirements_windows.txt pip install -e . From 0558730c2b50599d02e0fd5ff82344d72852f769 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 17:21:46 +0200 Subject: [PATCH 23/42] Blind test.ps1 ! --- scripts/test.ps1 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/test.ps1 b/scripts/test.ps1 index 1115fb196..f8508938c 100755 --- a/scripts/test.ps1 +++ b/scripts/test.ps1 @@ -1,6 +1,5 @@ -set PREFIX="venv/bin/" -PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov=uvicorn --cov=tests --cov-report=term-missing ${@} -${PREFIX}coverage html -${PREFIX}autoflake --recursive uvicorn tests -${PREFIX}flake8 uvicorn tests --ignore=W503,E203,E501,E731 -${PREFIX}black uvicorn tests --check +PYTHONPATH=. pytest --ignore venv --cov=uvicorn --cov=tests --cov-report=term-missing +coverage html +autoflake --recursive uvicorn tests +flake8 uvicorn tests --ignore=W503,E203,E501,E731 +black uvicorn tests --check From 91a040282db6a64443393ee710b22fdd96dfbc85 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 17:25:27 +0200 Subject: [PATCH 24/42] Blind test.ps1 love --- scripts/test.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test.ps1 b/scripts/test.ps1 index f8508938c..3b16be40c 100755 --- a/scripts/test.ps1 +++ b/scripts/test.ps1 @@ -1,4 +1,4 @@ -PYTHONPATH=. pytest --ignore venv --cov=uvicorn --cov=tests --cov-report=term-missing +pytest --ignore venv --cov=uvicorn --cov=tests --cov-report=term-missing coverage html autoflake --recursive uvicorn tests flake8 uvicorn tests --ignore=W503,E203,E501,E731 From dd3d593e0ad7c5e67fd02f5a169afe628c84a4dd Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 17:34:53 +0200 Subject: [PATCH 25/42] Attempt specifying shell explicitely --- .github/workflows/test-suite.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 4b7ade8f1..a1f642987 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -16,10 +16,10 @@ jobs: python-version: ["3.6", "3.7", "3.8"] os: [windows-latest, ubuntu-latest] include: - - os: windows-latest - script_install: "scripts/install.ps1" - script_test: "scripts/test.ps1" - - os: ubuntu-latest +# - os: windows-latest +# script_install: "scripts/install.ps1" +# script_test: "scripts/test.ps1" +# - os: ubuntu-latest script_install: "scripts/install.sh" script_test: "scripts/test.sh" steps: @@ -29,5 +29,7 @@ jobs: python-version: "${{ matrix.python-version }}" - name: "Install dependencies" run: "${{ matrix.script_install }}" + shell: bash - name: "Run tests" run: "${{ matrix.script_test }}" + shell: bash From d94417bf95f8b4dbea306771f0afb422d15a47a2 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:05:28 +0200 Subject: [PATCH 26/42] Try using bash on windows --- .github/workflows/test-suite.yml | 8 ++++---- scripts/install.ps1 | 2 -- scripts/test.ps1 | 5 ----- 3 files changed, 4 insertions(+), 11 deletions(-) delete mode 100755 scripts/install.ps1 delete mode 100755 scripts/test.ps1 diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index a1f642987..064dd83ce 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -16,10 +16,10 @@ jobs: python-version: ["3.6", "3.7", "3.8"] os: [windows-latest, ubuntu-latest] include: -# - os: windows-latest -# script_install: "scripts/install.ps1" -# script_test: "scripts/test.ps1" -# - os: ubuntu-latest + - os: windows-latest + script_install: "scripts/install.sh" + script_test: "scripts/test.sh" + - os: ubuntu-latest script_install: "scripts/install.sh" script_test: "scripts/test.sh" steps: diff --git a/scripts/install.ps1 b/scripts/install.ps1 deleted file mode 100755 index e35f7ec07..000000000 --- a/scripts/install.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -pip install -r requirements_windows.txt -pip install -e . diff --git a/scripts/test.ps1 b/scripts/test.ps1 deleted file mode 100755 index 3b16be40c..000000000 --- a/scripts/test.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -pytest --ignore venv --cov=uvicorn --cov=tests --cov-report=term-missing -coverage html -autoflake --recursive uvicorn tests -flake8 uvicorn tests --ignore=W503,E203,E501,E731 -black uvicorn tests --check From bfc0558de79110e79fa87428ca01720d61634802 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:08:36 +0200 Subject: [PATCH 27/42] Detect os for requirements --- scripts/install.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 65885a720..4eba98eee 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -3,16 +3,21 @@ # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" -REQUIREMENTS="requirements.txt" +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + REQUIREMENTS="requirements.txt" +elif [[ "$OSTYPE" == "win32" ]]; then + REQUIREMENTS="requirements_windows.txt" +fi + VENV="venv" set -x if [ -z "$GITHUB_ACTIONS" ]; then - "$PYTHON" -m venv "$VENV" - PIP="$VENV/bin/pip" + "$PYTHON" -m venv "$VENV" + PIP="$VENV/bin/pip" else - PIP="pip" + PIP="pip" fi "$PIP" install -r "$REQUIREMENTS" From 1e535ef80094d80909350d102e220c9034b829ca Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:12:51 +0200 Subject: [PATCH 28/42] Use sh comparison --- scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 4eba98eee..d1a10adb6 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -3,9 +3,9 @@ # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" -if [[ "$OSTYPE" == "linux-gnu"* ]]; then +if [ "$OSTYPE" = "linux-gnu" ]; then REQUIREMENTS="requirements.txt" -elif [[ "$OSTYPE" == "win32" ]]; then +elif [ "$OSTYPE" = "win32" ]; then REQUIREMENTS="requirements_windows.txt" fi From 561234e5eafee053196d1a83d6b0a8ff09f25c3e Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:15:20 +0200 Subject: [PATCH 29/42] Live debug --- scripts/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index d1a10adb6..e35c07938 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -3,6 +3,8 @@ # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" +echo $OSTYPE + if [ "$OSTYPE" = "linux-gnu" ]; then REQUIREMENTS="requirements.txt" elif [ "$OSTYPE" = "win32" ]; then From 0c1c2805bedbf0ebdc77ed96da63e2ecb5c113cd Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:17:52 +0200 Subject: [PATCH 30/42] Live debug 2 --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index e35c07938..c6b7c6dfa 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/sh -exo # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" From 54f78569e861eeb4b969c87ebd47fd188f9ff6a0 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:21:28 +0200 Subject: [PATCH 31/42] More echo --- scripts/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index c6b7c6dfa..a5553be90 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -11,6 +11,8 @@ elif [ "$OSTYPE" = "win32" ]; then REQUIREMENTS="requirements_windows.txt" fi +echo "$REQUIREMENTS" + VENV="venv" set -x From b1a62aa7e6d2243a90efd08f50ce2379799fc985 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:24:23 +0200 Subject: [PATCH 32/42] More echo --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index a5553be90..021af3b90 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,4 +1,4 @@ -#!/bin/sh -exo +#!/bin/sh -e # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" From d6c98d16937aa6842f2ae65f794c241e67b8d98e Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:29:46 +0200 Subject: [PATCH 33/42] More echo 2 --- scripts/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index 021af3b90..a04115555 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -9,6 +9,8 @@ if [ "$OSTYPE" = "linux-gnu" ]; then REQUIREMENTS="requirements.txt" elif [ "$OSTYPE" = "win32" ]; then REQUIREMENTS="requirements_windows.txt" +else + echo "SHIT" fi echo "$REQUIREMENTS" From 6ce7a55f6d2537d89012b34ac5f9b669080cf301 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:33:01 +0200 Subject: [PATCH 34/42] OSTYPE only in bash --- scripts/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index a04115555..9ca73bbc1 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/usr/bin/env bash + +set euxo -pipefail # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" From 18d20fa941f0a6ae5def60ea41ac7670347a41df Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 19:35:41 +0200 Subject: [PATCH 35/42] OSTYPE seems to be msys --- scripts/install.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 9ca73bbc1..17f1f0c41 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -5,11 +5,9 @@ set euxo -pipefail # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" -echo $OSTYPE - if [ "$OSTYPE" = "linux-gnu" ]; then REQUIREMENTS="requirements.txt" -elif [ "$OSTYPE" = "win32" ]; then +elif [ "$OSTYPE" = "msys" ]; then REQUIREMENTS="requirements_windows.txt" else echo "SHIT" From 659e5e3d848c25162271eba73e9c00082bb31415 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 20 Jul 2020 20:08:28 +0200 Subject: [PATCH 36/42] Using old names for scripts since we dont need to differentiate now between os --- .github/workflows/test-suite.yml | 11 ++--------- scripts/{install.sh => install} | 0 scripts/{test.sh => test} | 0 3 files changed, 2 insertions(+), 9 deletions(-) rename scripts/{install.sh => install} (100%) rename scripts/{test.sh => test} (100%) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 064dd83ce..084e162ea 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -15,21 +15,14 @@ jobs: matrix: python-version: ["3.6", "3.7", "3.8"] os: [windows-latest, ubuntu-latest] - include: - - os: windows-latest - script_install: "scripts/install.sh" - script_test: "scripts/test.sh" - - os: ubuntu-latest - script_install: "scripts/install.sh" - script_test: "scripts/test.sh" steps: - uses: "actions/checkout@v2" - uses: "actions/setup-python@v1" with: python-version: "${{ matrix.python-version }}" - name: "Install dependencies" - run: "${{ matrix.script_install }}" + run: "scripts/install" shell: bash - name: "Run tests" - run: "${{ matrix.script_test }}" + run: "scripts/test" shell: bash diff --git a/scripts/install.sh b/scripts/install similarity index 100% rename from scripts/install.sh rename to scripts/install diff --git a/scripts/test.sh b/scripts/test similarity index 100% rename from scripts/test.sh rename to scripts/test From 9e8348057b5a01882e28543a2edfcc5d4c9fc284 Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 21 Jul 2020 14:59:43 +0200 Subject: [PATCH 37/42] Removed echo leftovers from live debugging and indented back to 4 spaces --- scripts/install | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index 17f1f0c41..5613b8ac6 100755 --- a/scripts/install +++ b/scripts/install @@ -6,24 +6,20 @@ set euxo -pipefail [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" if [ "$OSTYPE" = "linux-gnu" ]; then - REQUIREMENTS="requirements.txt" + REQUIREMENTS="requirements.txt" elif [ "$OSTYPE" = "msys" ]; then - REQUIREMENTS="requirements_windows.txt" -else - echo "SHIT" + REQUIREMENTS="requirements_windows.txt" fi -echo "$REQUIREMENTS" - VENV="venv" set -x if [ -z "$GITHUB_ACTIONS" ]; then - "$PYTHON" -m venv "$VENV" - PIP="$VENV/bin/pip" + "$PYTHON" -m venv "$VENV" + PIP="$VENV/bin/pip" else - PIP="pip" + PIP="pip" fi "$PIP" install -r "$REQUIREMENTS" From 1128502959e623a8df7daf8a0f48be8f9419b721 Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 21 Jul 2020 15:30:03 +0200 Subject: [PATCH 38/42] Correct set --- scripts/install | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 5613b8ac6..7f0c361f4 100755 --- a/scripts/install +++ b/scripts/install @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set euxo -pipefail +set -euxo pipefail # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" @@ -13,8 +13,6 @@ fi VENV="venv" -set -x - if [ -z "$GITHUB_ACTIONS" ]; then "$PYTHON" -m venv "$VENV" PIP="$VENV/bin/pip" From 5ddb0a40dc5321b2177ee613eafdf22b2a1410b7 Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 21 Jul 2020 15:32:40 +0200 Subject: [PATCH 39/42] Removin=g unboud variable check --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7f0c361f4..3ee4b54fa 100755 --- a/scripts/install +++ b/scripts/install @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -euxo pipefail +set -exo pipefail # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" From ed5896bbafd61f2b3233a09951fd8fc5ee1dce7f Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 21 Jul 2020 16:11:21 +0200 Subject: [PATCH 40/42] Set -x before pip only --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 3ee4b54fa..636aa2c62 100755 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -exo pipefail - # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" @@ -11,6 +9,7 @@ elif [ "$OSTYPE" = "msys" ]; then REQUIREMENTS="requirements_windows.txt" fi +set -x VENV="venv" if [ -z "$GITHUB_ACTIONS" ]; then From edd287f0e490b1b1a59df72f329b4aef72c53157 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 21 Jul 2020 15:21:44 +0100 Subject: [PATCH 41/42] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 636aa2c62..d150d30b5 100755 --- a/scripts/install +++ b/scripts/install @@ -8,9 +8,9 @@ if [ "$OSTYPE" = "linux-gnu" ]; then elif [ "$OSTYPE" = "msys" ]; then REQUIREMENTS="requirements_windows.txt" fi +VENV="venv" set -x -VENV="venv" if [ -z "$GITHUB_ACTIONS" ]; then "$PYTHON" -m venv "$VENV" From 8e373369611f955b7469ac0ef6e7ae90dd5bc2c9 Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 21 Jul 2020 16:55:16 +0200 Subject: [PATCH 42/42] Set -e --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 636aa2c62..edea44eaf 100755 --- a/scripts/install +++ b/scripts/install @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + # Use the Python executable provided from the `-p` option, or a default. [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3"