[pre-commit.ci] auto fixes from pre-commit.com hooks #96
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: Linux | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| paths: | |
| - '**' | |
| tags: | |
| - 'v*.*.*' | |
| pull_request: | |
| branches: | |
| - 'master' | |
| paths: | |
| - '**' | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 60 | |
| env: | |
| COVERAGE_PROCESS_START: "${{ github.workspace }}/.coveragerc" | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| matrix: | |
| julia-version: ['1'] | |
| python-version: ['3.13'] | |
| os: [ubuntu-latest] | |
| test-id: [main] | |
| include: | |
| - julia-version: '1.10' | |
| python-version: '3.10' | |
| os: ubuntu-latest | |
| test-id: include | |
| - julia-version: '1' | |
| python-version: '3.13' | |
| os: ubuntu-latest | |
| test-id: include | |
| - julia-version: '1' | |
| python-version: '3.9' | |
| os: ubuntu-latest | |
| test-id: include | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Julia" | |
| uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: ${{ matrix.julia-version }} | |
| - name: "Cache Julia" | |
| uses: julia-actions/cache@v2 | |
| with: | |
| cache-name: ${{ matrix.os }}-test-${{ matrix.julia-version }}-${{ matrix.python-version }} | |
| cache-packages: false | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: "Install PySR" | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install '.[dev]' | |
| python -c 'import pysr' | |
| - name: "Assert Julia version" | |
| if: ${{ matrix.julia-version != '1'}} | |
| run: python3 -c "from pysr import jl; assert jl.VERSION.major == jl.seval('v\"${{ matrix.julia-version }}\"').major; assert jl.VERSION.minor == jl.seval('v\"${{ matrix.julia-version }}\"').minor" | |
| - name: "Set up coverage for subprocesses" | |
| run: echo 'import coverage; coverage.process_startup()' > "${{ github.workspace }}/sitecustomize.py" | |
| - name: "Run tests" | |
| run: coverage run -m pysr test main,cli,startup | |
| - name: "Run JAX tests" | |
| run: coverage run --append -m pysr test jax | |
| if: ${{ matrix.test-id == 'main' }} | |
| - name: "Run Torch tests" | |
| run: coverage run --append -m pysr test torch | |
| if: ${{ matrix.test-id == 'main' }} | |
| - name: "Build coverage report" | |
| run: coverage xml | |
| - name: "Upload results to Codecov" | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: MilesCranmer/PySR | |
| dev_install: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: ['ubuntu-latest'] | |
| python-version: ['3.13'] | |
| julia-version: ['1'] | |
| include: | |
| - os: ubuntu-latest | |
| python-version: '3.10' | |
| julia-version: '1.10' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| - name: "Install PySR" | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install '.[dev]' | |
| - name: "Run development test" | |
| run: PYSR_TEST_JULIA_VERSION=${{ matrix.julia-version }} PYSR_TEST_PYTHON_VERSION=${{ matrix.python-version }} python -m pysr test dev | |
| conda_test: | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| strategy: | |
| matrix: | |
| # NOTE: pin to a known-supported CPython; `3` can resolve to free-threaded | |
| # builds (e.g. 3.14t) which PythonCall.jl doesn't support. | |
| python-version: ['3.13'] | |
| os: ['ubuntu-latest'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Cache conda" | |
| uses: actions/cache@v5 | |
| env: | |
| CACHE_NUMBER: 0 | |
| with: | |
| path: ~/conda_pkgs_dir | |
| key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} | |
| - name: "Set up Conda" | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| auto-activate-base: true | |
| python-version: ${{ matrix.python-version }} | |
| activate-environment: pysr-test | |
| environment-file: environment.yml | |
| - name: "Cache Julia" | |
| uses: julia-actions/cache@v2 | |
| with: | |
| cache-name: ${{ matrix.os }}-conda-${{ matrix.python-version }} | |
| cache-packages: false | |
| - name: "Install PySR" | |
| run: | | |
| python3 -m pip install . | |
| python3 -c 'import pysr' | |
| - name: "Run tests" | |
| run: cd /tmp && python -m pysr test main | |
| types: | |
| name: Check types | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| strategy: | |
| matrix: | |
| python-version: | |
| - '3.13' | |
| - '3.10' | |
| os: ['ubuntu-latest'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: "Install PySR and all dependencies" | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install '.[dev]' | |
| - name: "Run mypy" | |
| run: python -m mypy --install-types --non-interactive pysr | |
| if: ${{ matrix.python-version != '3.10' }} | |
| - name: "Run compatible mypy" | |
| run: python -m mypy --ignore-missing-imports pysr | |
| if: ${{ matrix.python-version == '3.10' }} | |
| beartype: | |
| name: Test with beartype | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| PYSR_USE_BEARTYPE: "1" | |
| strategy: | |
| matrix: | |
| python-version: ['3.13'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: "Install PySR and all dependencies" | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install '.[dev]' | |
| - name: "Run tests" | |
| run: python -m pysr test main,jax,torch | |
| autodiff_backends: | |
| name: Test autodiff backends | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| strategy: | |
| matrix: | |
| python-version: ['3.13'] | |
| julia-version: ['1'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Julia" | |
| uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: ${{ matrix.julia-version }} | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: "Install PySR and all dependencies" | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install '.[dev]' | |
| - name: "Run autodiff backend tests" | |
| run: python -m pysr test autodiff | |
| wheel_test: | |
| name: Test from wheel | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3'] | |
| julia-version: ['1'] | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: ${{ matrix.julia-version }} | |
| - name: "Build wheel" | |
| run: | | |
| python -m pip install --upgrade pip build virtualenv | |
| python -m build --wheel | |
| mkdir -p /tmp/artifacts | |
| mv dist/*.whl /tmp/artifacts/ | |
| - name: "Install wheel in venv & run smoke test" | |
| run: | | |
| mkdir -p /tmp/wheeltest | |
| cd /tmp/wheeltest | |
| python -m virtualenv .venv | |
| source .venv/bin/activate | |
| pip install /tmp/artifacts/*.whl | |
| python -c "import pysr; pysr.PySRRegressor(niterations=1).fit([[1]], [1])" | |
| validate_papers_yml: | |
| name: Validate docs/papers.yml | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| cache: pip | |
| - name: "Install validator deps" | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyyaml | |
| - name: "Validate papers.yml" | |
| run: python scripts/validate_papers_yml.py |