Run benchmarks on CodSpeed in CI #10535
Workflow file for this run
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: pyrefly | |
| on: | |
| push: | |
| paths: | |
| - '**/*' | |
| - '!.*' | |
| - '.github/workflows/pyrefly.yml' | |
| pull_request: | |
| schedule: | |
| - cron: '0 12 * * 1' # 12pm Monday | |
| workflow_call: | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macOS-latest] | |
| include: | |
| - os: windows-latest | |
| github_env: $env:GITHUB_ENV | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: set windows cargo home | |
| # we need to set CARGO_HOME to a high-up directory on Windows machines, since some dependencies cloned | |
| # by Cargo have long paths and will cause builds/tests to fail | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| run: echo "CARGO_HOME=C:\\cargo" >> ${{ matrix.github_env }} | |
| - name: install Scrut | |
| run: cargo install scrut --locked | |
| # Scrut doesn't support Windows yet | |
| if: ${{ matrix.os != 'windows-latest' }} | |
| - name: set up rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| prefix-key: pyrefly | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| components: clippy, rustfmt | |
| - run: cargo fmt -- --check | |
| - run: cargo clippy --release | |
| - run: cargo build --release | |
| - run: cargo test --release | |
| - name: Run torch stub tests | |
| run: python tensor-shapes/pyrefly-torch-stubs/run_pyrefly.py --release | |
| - name: Run Scrut tests | |
| env: | |
| PYREFLY: ${{ github.workspace }}/target/release/pyrefly | |
| TYPESHED_ROOT: ${{ github.workspace }}/crates/pyrefly_bundled/third_party | |
| JQ: jq | |
| TEST_PY: ${{ github.workspace }}/test.py | |
| PYREFLY_PY: ${{ github.workspace }}/pyrefly/python | |
| run: env -u GITHUB_ACTIONS scrut test test | |
| if: ${{ matrix.os != 'windows-latest' }} | |
| - name: Set up torch runtime test environment | |
| shell: bash | |
| run: | | |
| python -m venv .tensor-shapes-venv | |
| if [ -x .tensor-shapes-venv/bin/python ]; then | |
| TENSOR_SHAPES_PYTHON=.tensor-shapes-venv/bin/python | |
| else | |
| TENSOR_SHAPES_PYTHON=.tensor-shapes-venv/Scripts/python.exe | |
| fi | |
| echo "TENSOR_SHAPES_PYTHON=$TENSOR_SHAPES_PYTHON" >> "$GITHUB_ENV" | |
| "$TENSOR_SHAPES_PYTHON" -m pip install --upgrade pip | |
| "$TENSOR_SHAPES_PYTHON" -m pip install torch | |
| - name: Run torch runtime tests | |
| shell: bash | |
| run: | | |
| "$TENSOR_SHAPES_PYTHON" tensor-shapes/pyrefly-torch-stubs/run_runtime_tests.py |