From 68014225f0011b138e7d77d167665f0d0af09aad Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 2 Dec 2019 17:55:45 +0100 Subject: [PATCH 1/5] GitHub Action: Run Python tests on Ubuntu & macOS Running Python standalone tests on multiple OSes would free up Travis CI for tests of various combinations of Node.js and Python as well as tests on other [CPU architectures](https://docs.travis-ci.com/user/multi-cpu-architectures). __arch: amd64, arm64, ppc64le, s390x__ --- .github/workflows/Python_tests.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/Python_tests.yml diff --git a/.github/workflows/Python_tests.yml b/.github/workflows/Python_tests.yml new file mode 100644 index 0000000000..e312335051 --- /dev/null +++ b/.github/workflows/Python_tests.yml @@ -0,0 +1,36 @@ +# TODO: Enable os: windows-latest +# TODO: Enable python-version: 3.5 +# TODO: Enable pytest --doctest-modules + +name: Python_tests +on: [push] +jobs: + Python_tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 15 + matrix: + os: [macos-latest, ubuntu-latest] # , windows-latest] + python-version: [2.7, 3.6, 3.7, 3.8] # 3.5, + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest # -r requirements.txt + - name: Lint with flake8 + if: ${{ matrix.os }} == "ubuntu-latest" + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: pytest + # - name: Run doctests with pytest + # run: pytest --doctest-modules From f63a37104da844798088972bbf7e0e29a3d94e27 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 2 Dec 2019 18:02:58 +0100 Subject: [PATCH 2/5] if: matrix.os == "ubuntu-latest" --- .github/workflows/Python_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Python_tests.yml b/.github/workflows/Python_tests.yml index e312335051..5f4a0f553e 100644 --- a/.github/workflows/Python_tests.yml +++ b/.github/workflows/Python_tests.yml @@ -24,7 +24,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest # -r requirements.txt - name: Lint with flake8 - if: ${{ matrix.os }} == "ubuntu-latest" + if: matrix.os == "ubuntu-latest" run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics From ba98118b24d3b8ed728b5891f643ca89fefbf749 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 2 Dec 2019 18:11:08 +0100 Subject: [PATCH 3/5] Single quotes, not double quotes --- .github/workflows/Python_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Python_tests.yml b/.github/workflows/Python_tests.yml index 5f4a0f553e..63599a09fd 100644 --- a/.github/workflows/Python_tests.yml +++ b/.github/workflows/Python_tests.yml @@ -24,7 +24,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest # -r requirements.txt - name: Lint with flake8 - if: matrix.os == "ubuntu-latest" + if: matrix.os == 'ubuntu-latest' run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics From 416b80f207f14cf732a993f6b41edf27e60f0f4f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 2 Dec 2019 18:32:50 +0100 Subject: [PATCH 4/5] Update Python_tests.yml --- .github/workflows/Python_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Python_tests.yml b/.github/workflows/Python_tests.yml index 63599a09fd..f988d283bc 100644 --- a/.github/workflows/Python_tests.yml +++ b/.github/workflows/Python_tests.yml @@ -1,6 +1,6 @@ -# TODO: Enable os: windows-latest -# TODO: Enable python-version: 3.5 -# TODO: Enable pytest --doctest-modules +# TODO: Line 14, enable os: windows-latest +# TODO: Line 15, enable python-version: 3.5 +# TODO: Line 36, enable pytest --doctest-modules name: Python_tests on: [push] From f94bc3d8d4ae1dfb3da8ce8dce988681f17ab059 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 12 Dec 2019 04:57:02 +0100 Subject: [PATCH 5/5] Run on pull_request too. --- .github/workflows/Python_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Python_tests.yml b/.github/workflows/Python_tests.yml index f988d283bc..235127f21a 100644 --- a/.github/workflows/Python_tests.yml +++ b/.github/workflows/Python_tests.yml @@ -3,7 +3,7 @@ # TODO: Line 36, enable pytest --doctest-modules name: Python_tests -on: [push] +on: [push, pull_request] jobs: Python_tests: runs-on: ${{ matrix.os }}