Skip to content

Nightly: Python CI #160

Nightly: Python CI

Nightly: Python CI #160

name: 'Nightly: Python CI'
# Run builds daily at 2am UTC (10p EST) on weekdays for now, or manually
on:
schedule:
- cron: "0 2 * * 1-5"
defaults:
run:
working-directory: 'extensions/positron-python'
env:
NODE_VERSION: '18.17.1'
PYTHON_VERSION: '3.10'
PROJECT_DIR: 'extensions/positron-python'
PYTHON_SRC_DIR: 'extensions/positron-python/python_files'
# Force a path with spaces and to test extension works in these scenarios
# Unicode characters are causing 2.7 failures so skip that for now.
special-working-directory: './path with spaces'
special-working-directory-relative: 'path with spaces'
jobs:
# Run full suite of upstream tests
vscode-python-tests:
name: Upstream Python Tests
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.special-working-directory }}/${{ env.PROJECT_DIR}}
strategy:
fail-fast: false
matrix:
include:
- os: 'ubuntu-latest'
python: '3.8'
- os: 'ubuntu-latest'
python: '3.9'
- os: 'windows-latest'
python: '3.10'
- os: 'ubuntu-latest'
python: '3.11'
- os: 'ubuntu-latest'
python: '3.12'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.special-working-directory-relative }}
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install specific pytest version
run: |
python -m pip install pytest
- name: Install specific pytest version
run: python -m pytest --version
- name: Install base Python requirements
run: 'python -m pip install --no-deps --require-hashes --only-binary :all: -t ./python_files/lib/python --no-cache-dir --implementation py -r requirements.txt'
- name: Install test requirements
run: python -m pip install -r build/test-requirements.txt
- name: Run Python unit tests
run: python python_files/tests/run_all.py --junit-xml=python-unit-test-results.xml
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: upstream-test-output-${{ matrix.os }}-${{ matrix.python }}
path: ${{ github.workspace }}/${{ env.special-working-directory-relative }}/extensions/positron-python/python-unit-test-results.xml
# Install the latest releases of test dependencies
positron-ipykernel-tests-latest:
name: Test latest Positron IPyKernel
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: 'ubuntu-latest'
python: '3.8'
- os: 'macos-13'
python: '3.9'
- os: 'windows-latest'
python: '3.10'
- os: 'ubuntu-latest'
python: '3.11'
- os: 'ubuntu-latest'
python: '3.12'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install Positron IPyKernel requirements
run: python scripts/vendor.py
- name: Install latest versions Positron IPyKernel test requirements
run: python -m pip install --prefer-binary --upgrade -r python_files/positron/test-requirements.txt
- name: Run Positron IPyKernel unit tests
run: pytest python_files/positron --junit-xml=python-test-results.xml
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: ipykernel-test-output-${{ matrix.os }}-${{ matrix.python }}
path: extensions/positron-python/python-test-results.xml
slack-notification:
if: always()
name: 'Send Slack notification'
runs-on: ubuntu-latest
needs: [vscode-python-tests, positron-ipykernel-tests-latest]
steps:
- name: Download test artifacts
uses: actions/download-artifact@v4
with:
path: test-artifacts
- name: 'Send Slack notification'
uses: automattic/[email protected]
with:
github_token: ${{ secrets.POSITRON_GITHUB_PAT }}
slack_token: ${{ secrets.SMOKE_TESTS_SLACK_TOKEN }}
slack_channel: C07FR1JNZNJ #positron-test-results channel