From a93cee1a305899ad1dca58a5ca5c882c190fc1cb Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sun, 22 Nov 2020 01:15:44 +0000 Subject: [PATCH] Run a sample build before tests on PRs with this label --- .github/workflows/test.yml | 11 +++++++++++ bin/sample_build.py | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 bin/sample_build.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fdd20d0f..d65a52b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,10 +37,21 @@ jobs: - name: Install dependencies run: | python -m pip install -r requirements-dev.txt + - name: Install Visual C++ for Python 2.7 if: runner.os == 'Windows' run: | choco install vcpython27 -f -y + + - name: Get PR labels + id: pr-labels + uses: joerick/pr-labels-action@v1.0.5 + + - name: Sample build + if: contains(steps.pr-labels.outputs.labels, ' ci-sample-build ') + run: | + python bin/sample_build.py + - name: Test cibuildwheel run: | python ./bin/run_tests.py diff --git a/bin/sample_build.py b/bin/sample_build.py new file mode 100755 index 00000000..c8a13e67 --- /dev/null +++ b/bin/sample_build.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +import os +import subprocess +import sys +import argparse +import tempfile +from pathlib import Path + +if __name__ == '__main__': + # move cwd to the project root + os.chdir(Path(__file__).resolve().parents[1]) + + parser = argparse.ArgumentParser(description='Runs a sample build') + parser.add_argument('PROJECT_PYTHON_PATH', nargs='?', default='test.test_0_basic.basic_project') + + options = parser.parse_args() + print(options) + + project_dir = tempfile.mkdtemp() + subprocess.run([sys.executable, '-m', 'test.test_projects', options.PROJECT_PYTHON_PATH, project_dir], check=True) + + subprocess.run(['cibuildwheel'], check=True, cwd=project_dir)