|
| 1 | +name: PR Validation |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +permissions: {} |
| 7 | + |
| 8 | +env: |
| 9 | + NODE_VERSION: 18.17.1 |
| 10 | + TEST_RESULTS_DIRECTORY: . |
| 11 | + # Force a path with spaces and unicode chars to test extension works in these scenarios |
| 12 | + special-working-directory: './🐍 🐛' |
| 13 | + special-working-directory-relative: '🐍 🐛' |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-vsix: |
| 17 | + name: Create VSIX |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + persist-credentials: false |
| 24 | + |
| 25 | + - name: Build VSIX |
| 26 | + uses: ./.github/actions/build-vsix |
| 27 | + with: |
| 28 | + node_version: ${{ env.NODE_VERSION }} |
| 29 | + |
| 30 | + lint: |
| 31 | + name: Lint |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + persist-credentials: false |
| 38 | + |
| 39 | + - name: Lint |
| 40 | + uses: ./.github/actions/lint |
| 41 | + with: |
| 42 | + node_version: ${{ env.NODE_VERSION }} |
| 43 | + |
| 44 | + tests: |
| 45 | + name: Tests |
| 46 | + runs-on: ${{ matrix.os }} |
| 47 | + defaults: |
| 48 | + run: |
| 49 | + working-directory: ${{ env.special-working-directory }} |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + os: [ubuntu-latest, windows-latest] |
| 54 | + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 55 | + |
| 56 | + steps: |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@v4 |
| 59 | + with: |
| 60 | + path: ${{ env.special-working-directory-relative }} |
| 61 | + persist-credentials: false |
| 62 | + |
| 63 | + # Install bundled libs using 3.9 even though you test it on other versions. |
| 64 | + - name: Use Python 3.9 |
| 65 | + uses: actions/setup-python@v5 |
| 66 | + with: |
| 67 | + python-version: '3.9' |
| 68 | + |
| 69 | + - name: Update pip, install pipx and install wheel |
| 70 | + run: python -m pip install -U pip pipx wheel |
| 71 | + shell: bash |
| 72 | + |
| 73 | + # This will install libraries to a target directory. |
| 74 | + - name: Install bundled python libraries |
| 75 | + run: pipx run nox --session install_bundled_libs |
| 76 | + shell: bash |
| 77 | + |
| 78 | + - name: Install Node |
| 79 | + uses: actions/setup-node@v4 |
| 80 | + with: |
| 81 | + node-version: ${{ env.NODE_VERSION }} |
| 82 | + cache: 'npm' |
| 83 | + cache-dependency-path: ${{ env.special-working-directory-relative }}/package-lock.json |
| 84 | + |
| 85 | + - name: Install dependencies (npm ci) |
| 86 | + run: npm ci |
| 87 | + |
| 88 | + # Now that the bundle is installed to target using python 3.9 |
| 89 | + # switch back the python we want to test with |
| 90 | + - name: Use Python ${{ matrix.python }} |
| 91 | + uses: actions/setup-python@v5 |
| 92 | + with: |
| 93 | + python-version: ${{ matrix.python }} |
| 94 | + |
| 95 | + # The new python may not have nox so install it again |
| 96 | + - name: Update pip, install pipx and install wheel (again) |
| 97 | + run: python -m pip install -U pip pipx wheel |
| 98 | + shell: bash |
| 99 | + |
| 100 | + - name: Start xvfb on Linux |
| 101 | + run: | |
| 102 | + /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & |
| 103 | + echo "DISPLAY=:99" >> $GITHUB_ENV |
| 104 | + echo ">>> Started xvfb" |
| 105 | + if: ${{ runner.os }} == 'Linux' |
| 106 | + |
| 107 | + - name: Run tests |
| 108 | + run: pipx run nox --session tests |
| 109 | + shell: bash |
| 110 | + env: |
| 111 | + DISPLAY: ${{ env.DISPLAY }} |
0 commit comments