Skip to content

Commit c27850c

Browse files
committed
ci: switch to GitHub Actions
1 parent 741ab09 commit c27850c

File tree

3 files changed

+104
-103
lines changed

3 files changed

+104
-103
lines changed
Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
# TODO: Line 15, enable python-version: 3.5
22
# TODO: Line 36, enable pytest --doctest-modules
33

4-
name: Python_tests
5-
on: [push, pull_request]
4+
name: Python Tests
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
pull_request:
11+
branches:
12+
- master
13+
614
jobs:
7-
Python_tests:
15+
test:
816
runs-on: ${{ matrix.os }}
917
strategy:
1018
fail-fast: false
1119
max-parallel: 15
1220
matrix:
1321
os: [macos-latest, ubuntu-latest, windows-latest]
14-
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
22+
python-version: [2.7, 3.6, 3.7, 3.8]
1523
steps:
1624
- uses: actions/checkout@v2
1725
- name: Set up Python ${{ matrix.python-version }}
@@ -29,12 +37,13 @@ jobs:
2937
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3038
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3139
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
32-
- name: Test with pytest (Linux and macOS)
33-
if: matrix.os != 'windows-latest'
34-
run: pytest
35-
- name: Test with pytest (Windows)
36-
if: matrix.os == 'windows-latest'
40+
- name: Test with pytest
3741
shell: bash
38-
run: GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" pytest
42+
run: |
43+
if [ "$RUNNER_OS" == "Windows" ]; then
44+
GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" python -m pytest
45+
else
46+
python -m pytest
47+
fi
3948
# - name: Run doctests with pytest
4049
# run: pytest --doctest-modules

.github/workflows/test.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
node: [10.x, 12.x, 14.x]
17+
python: [2.7, 3.6, 3.7, 3.8]
18+
os: [macos-latest, ubuntu-latest, windows-latest]
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node }}
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: ${{ matrix.node }}
27+
- name: Use Python ${{ matrix.python }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python }}
31+
- name: Set Env Vars
32+
shell: bash
33+
run: |
34+
if [ "$PYTHON_VERSION" == 2.7 ]; then
35+
if [ "$RUNNER_OS" == "Windows" ]; then
36+
echo "::add-path::/c/Python27:/c/Python27/Scripts"
37+
echo "::set-env name=NODE_GYP_FORCE_PYTHON::/c/Python27/python.exe"
38+
else
39+
echo "::set-env name=NODE_GYP_FORCE_PYTHON::python2"
40+
fi
41+
elif [ "$PYTHON_VERSION" == 3.6 ]; then
42+
if [ "$RUNNER_OS" == "Windows" ]; then
43+
echo "::add-path::/c/Python36:/c/Python36/Scripts"
44+
echo "::set-env name=NODE_GYP_FORCE_PYTHON::/c/Python36/python.exe"
45+
else
46+
echo "::set-env name=NODE_GYP_FORCE_PYTHON::python3"
47+
fi
48+
elif [ "$PYTHON_VERSION" == 3.7 ]; then
49+
if [ "$RUNNER_OS" == "Windows" ]; then
50+
echo "::add-path::/c/Python37:/c/Python37/Scripts"
51+
echo "::set-env name=NODE_GYP_FORCE_PYTHON::/c/Python37/python.exe"
52+
else
53+
echo "::set-env name=NODE_GYP_FORCE_PYTHON::python3"
54+
fi
55+
elif [ "$PYTHON_VERSION" == 3.8 ]; then
56+
if [ "$RUNNER_OS" == "Windows" ]; then
57+
echo "::add-path::/c/Python38:/c/Python38/Scripts"
58+
echo "::set-env name=NODE_GYP_FORCE_PYTHON::/c/Python38/python.exe"
59+
else
60+
echo "::set-env name=NODE_GYP_FORCE_PYTHON::python3"
61+
fi
62+
else
63+
echo "Nonexistent python version: $PYTHON_VERSION"
64+
exit 1
65+
fi
66+
env:
67+
PYTHON_VERSION: ${{ matrix.python }}
68+
- name: Install Dependencies
69+
run: |
70+
python -m pip install --upgrade flake8 pytest==4.6.6
71+
npm install
72+
- name: Lint Python
73+
run: |
74+
python -m flake8 --version
75+
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
76+
python -m flake8 . --count --exit-zero --ignore=E111,E114,W503 --max-complexity=10 --max-line-length=127 --statistics
77+
- name: Run Tests
78+
shell: bash
79+
run: |
80+
npm test
81+
if [ "$RUNNER_OS" == "Windows" ]; then
82+
GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" python -m pytest
83+
else
84+
python -m pytest
85+
fi

.travis.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)