From 2a0a80e79b4fab78f402a9a9def94b2cc1f76c4c Mon Sep 17 00:00:00 2001 From: Spencer Brown Date: Mon, 31 Jul 2023 18:23:47 +1000 Subject: [PATCH] Setup CI to run tests --- .github/workflows/run-tests.yml | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 000000000..682593338 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,61 @@ +name: Run tests + +on: + push: + branches: [ master, dev ] + pull_request: + branches: [ master, dev ] + workflow_dispatch: + # Allow triggering manually on other branches. + +permissions: + contents: read + pull-requests: read + +jobs: + run-tests: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + # We want 3.8 because it works on Windows 7. + - python-version: '3.8.10' + arch: 'x86' + os: 'windows-latest' + - python-version: '3.11' + arch: 'x64' + os: 'windows-latest' + - python-version: '3.12-dev' + arch: 'x64' + os: 'windows-latest' + - python-version: '3.11' + arch: 'x64' + os: 'ubuntu-latest' + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Set up Python ${{ matrix.python-version }}-${{ matrix.arch }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.arch }} + cache: 'pip' + cache-dependency-path: | + 'test-requirements.txt' + 'requirements.txt' + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install -r requirements.txt test-requirements.txt + - name: Test with pytest + # Enable Python's debug mode to do additional checks, and error if any uncaught warnings are + # produced. + run: | + python -X dev -Werror -m pytest src/tests/ + env: + PYTHONPATH: src/ + # Don't fail for beta versions of Python. + continue-on-error: ${{ contains(matrix.python-version, 'dev') }}