Skip to content

Build and Test PR

Build and Test PR #47

Workflow file for this run

name: Build and Test PR
# Builds and tests on all combinations of OS and python version.
# Also builds the docs.
#
# Runs when a pull request is opened or updated.
#
# Can also be run manually for debugging purposes.
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
ref:
description: "The ref to build and test."
required: False
defaults:
run:
shell: bash
jobs:
build_and_test:
strategy:
# Let other matrix entries complete, so we have all results on failure
# instead of just the first failure.
fail-fast: false
matrix:
# TODO: enable arm64 mac, self-hosted arm64 linux
# NOTE: macos-13 is explicitly x64
os: ["ubuntu-20.04", "macos-13", "windows-latest"]
# Our minimum supported version of Python is currently 3.6, which
# is not available after ubuntu-20.04
python_version: ["3.6", "3.7", "3.8", "3.9"]
include:
- os: ubuntu-20.04
os_name: linux
target_arch: x64
- os: macos-13
os_name: osx
target_arch: x64
- os: windows-latest
os_name: win
target_arch: x64
name: Build and test ${{ matrix.os_name }} ${{ matrix.target_arch }} Python ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref || github.ref }}
- name: Set Python version
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Debug Python version
run: python3 --version
- name: Install Python deps
run: |
python3 -m pip install --upgrade pyyaml sphinx flask mypy==0.812 wheel
if [[ '${{ runner.os }}' == 'Windows' ]]; then
python3 -m pip install --upgrade pywin32
fi
- name: Download binaries
run: |
# Fetch binaries locally instead of installing the release version of
# the binary package. This lets us test changes to the binary package
# before it is released.
python3 binaries/build_wheels.py
if [[ '${{ runner.os }}' == 'Windows' ]]; then
echo "PYTHONPATH=$GITHUB_WORKSPACE\\binaries;$PYTHONPATH" >> $GITHUB_ENV
else
echo "PYTHONPATH=$GITHUB_WORKSPACE/binaries:$PYTHONPATH" >> $GITHUB_ENV
fi
- name: Build docs (Linux only)
run: bash docs/build.sh
if: runner.os == 'Linux'
- name: Run tests
run: |
if [[ '${{ runner.os }}' == 'Linux' ]]; then
# Run without X11 on Linux by using xvfb.
WRAPPER="xvfb-run -a"
else
WRAPPER=""
fi
# Use the "spec" reporter for clearer logs in GitHub Actions
$WRAPPER python3 run_end_to_end_tests.py --reporters spec
#- name: Debug on failure
# uses: mxschmitt/action-tmate@v3
# if: ${{ failure() }}