diff --git a/.github/workflows/run-crt-test.yml b/.github/workflows/run-crt-test.yml new file mode 100644 index 0000000000..8132b44873 --- /dev/null +++ b/.github/workflows/run-crt-test.yml @@ -0,0 +1,31 @@ +name: Run CRT tests + +on: + push: + pull_request: + branches-ignore: [master] + +permissions: + contents: read + +jobs: + build: + runs-on: '${{ matrix.os }}' + strategy: + fail-fast: false + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + os: [ubuntu-latest, macOS-latest, windows-latest] + + steps: + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - name: 'Set up Python ${{ matrix.python-version }}' + uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 + with: + python-version: '${{ matrix.python-version }}' + - name: Install dependencies and CRT + run: | + python scripts/ci/install --extras crt + - name: Run tests + run: | + python scripts/ci/run-crt-tests --with-cov --with-xdist diff --git a/scripts/ci/install b/scripts/ci/install index 9309459fe4..5b26e7e96b 100755 --- a/scripts/ci/install +++ b/scripts/ci/install @@ -1,4 +1,5 @@ #!/usr/bin/env python +import argparse import os import shutil from contextlib import contextmanager @@ -25,6 +26,14 @@ def run(command): if __name__ == "__main__": + parser = argparse.ArgumentParser() + group = parser.add_mutually_exclusive_group() + group.add_argument( + '-e', + '--extras', + help='Install extras_require along with normal install', + ) + args = parser.parse_args() with cd(REPO_ROOT): run("pip install -r requirements.txt") run("python scripts/ci/install-dev-deps") @@ -32,4 +41,7 @@ if __name__ == "__main__": shutil.rmtree("dist") run("python setup.py bdist_wheel") wheel_dist = os.listdir("dist")[0] - run("pip install %s" % (os.path.join("dist", wheel_dist))) + package = os.path.join('dist', wheel_dist) + if args.extras: + package = f"\"{package}[{args.extras}]\"" + run(f"pip install {package}") diff --git a/scripts/ci/run-crt-tests b/scripts/ci/run-crt-tests index ceb607160f..b9e6ea06f3 100755 --- a/scripts/ci/run-crt-tests +++ b/scripts/ci/run-crt-tests @@ -36,4 +36,5 @@ except ImportError: if __name__ == "__main__": with cd(os.path.join(REPO_ROOT, "tests")): - run(f"{REPO_ROOT}/scripts/ci/run-tests unit/ functional/") + test_script = os.sep.join([REPO_ROOT, 'scripts', 'ci', 'run-tests']) + run(f"python {test_script} unit functional")