Build and Test PR #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
# TODO: re-enable pull_request trigger | |
#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 | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
# Our minimum supported version of Python is currently 3.6. | |
python_version: ["3.6", "3.7", "3.8", "3.9"] | |
include: | |
- os: ubuntu-latest | |
os_name: linux | |
target_arch: x64 | |
- os: macos-latest | |
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@v2 | |
with: | |
ref: ${{ github.event.inputs.ref || github.ref }} | |
- name: Set Python version | |
uses: actions/setup-python@v2 | |
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() }} |