run-core-tests #633
This file contains hidden or 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: run-core-tests | |
| jobs: | |
| test: | |
| name: Install and test Core | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
| # https://github.com/actions/runner-images/tree/main | |
| # ensure macos tag uses architecture identical to setup-python (x64 vs arm) | |
| os: [macos-15-intel] | |
| python-version: [ 3.9 ] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| if: github.event.pull_request.draft == false | |
| env: | |
| CP_MYSQL_TEST_HOST: "127.0.0.1" | |
| CP_MYSQL_TEST_DB: "cellprofiler_test" | |
| CP_MYSQL_TEST_USER: "root" | |
| CP_MYSQL_TEST_PASSWORD: "None" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| # NOTE: if/when we move to a runner using apple M[1-3] (arm64) | |
| # architecture we'll need to adjust: | |
| # https://github.com/actions/setup-python/issues/108 | |
| architecture: x64 | |
| python-version: ${{ matrix.python-version }} | |
| - name: Get pip cache dir | |
| id: pip-cache-dir | |
| run: | | |
| echo "PIP_CACHE_DIR=$(pip cache dir)" >> "$GITHUB_OUTPUT" | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| id: cache-pip | |
| with: | |
| path: ${{ steps.pip-cache-dir.outputs.PIP_CACHE_DIR }} | |
| key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} | |
| - name: Install Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "11" | |
| java-package: jdk | |
| architecture: x64 | |
| - name: Mac - Install and setup mysql | |
| if: startsWith(matrix.os, 'macos') | |
| env: | |
| LC_ALL: "en_US.UTF-8" | |
| run: | | |
| brew install [email protected] | |
| brew link [email protected] --force | |
| mysql.server start | |
| mysql --host=$CP_MYSQL_TEST_HOST --user=$CP_MYSQL_TEST_USER --execute="CREATE DATABASE $CP_MYSQL_TEST_DB;" --skip-password | |
| - name: Install CellProfiler | |
| run: | |
| | | |
| pip install pyinstaller | |
| pip install --upgrade pip "setuptools==64" "wheel>=0.45.0,<0.46" | |
| pip install "numpy>=1.20.1,<1.25.0" "Cython<3" | |
| pip install -e .[test] | |
| - name: Run Tests | |
| timeout-minutes: 10 | |
| run: | | |
| # add -rP if you want to see debug for all tests, not just failed ones | |
| pytest -v --exitfirst --disable-warnings -o log_cli_level=10 --tb=long --show-capture=all --capture=sys --color=yes --code-highlight=yes --timeout=60 -k 'not test_load_objects and not test_load_single_object' | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review, review_requested] | |
| push: | |
| branches: | |
| - 'master' | |
| workflow_dispatch: | |