|
| 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 |
0 commit comments