CI(macOS): verify rust toolchain after venv activation for editable i… #1
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: Test MacOS | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| python-version: | ||
| description: > | ||
| Python version to currently test | ||
| type: string | ||
| required: true | ||
| install-optionals: | ||
| description: > | ||
| Decides whether we install optyional dependencies | ||
| type: boolean | ||
| default: false | ||
| runner: | ||
| description: > | ||
| Describes the system this workflow should run on. | ||
| type: string | ||
| required: true | ||
| jobs: | ||
| tests-mac: | ||
| name: ${{ inputs.runner }} - Python ${{ inputs.python-version }} | ||
| runs-on: ${{ inputs.runner }} | ||
| timeout-minutes: 60 | ||
| env: | ||
| QISKIT_TEST_CAPTURE_STREAMS: 1 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Set up Python ${{ inputs.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ inputs.python-version }} | ||
| - name: Cache stestr | ||
| uses: actions/cache@v5 | ||
| with: | ||
| key: 'stestr | "${{ runner.os }}" | "${{ inputs.python-version }}" | "${{ github.run_id }}"' | ||
| restore-keys: | | ||
| stestr | "${{ runner.os }}" | "${{ inputs.python-version }}" | ||
| stestr | "${{ runner.os }}" | ||
| stestr | ||
| path: .stestr | ||
| - name: Set up Rust (minimal, for building qiskit) | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: stable | ||
| profile: minimal | ||
| components: "" | ||
| - name: Verify Rust toolchain | ||
| shell: bash | ||
| run: | | ||
| set -e | ||
| echo "PATH=$PATH" | ||
| which rustc | ||
| which cargo | ||
| rustc -V | ||
| cargo -V | ||
| - name: "Install dependencies" | ||
| shell: bash | ||
| env: | ||
| RUSTUP_TOOLCHAIN: stable | ||
| run: | | ||
| set -e | ||
| python -m venv test-job | ||
| source test-job/bin/activate | ||
| which rustc | ||
| which cargo | ||
| rustc -V | ||
| cargo -V | ||
| python -m pip install -U pip | ||
| python -m pip install -U \ | ||
| -c constraints.txt \ | ||
| --group test \ | ||
| -e . | ||
| - name: "Install optionals" | ||
| run: | | ||
| set -e | ||
| source test-job/bin/activate | ||
| pip install --group optionals-all -c constraints.txt | ||
| pip check | ||
| if: ${{ inputs.install-optionals }} | ||
| - name: "Run tests" | ||
| run: | | ||
| set -e | ||
| source test-job/bin/activate | ||
| python tools/report_numpy_state.py | ||
| export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 4294967295))") | ||
| echo "PYTHONHASHSEED=$PYTHONHASHSEED" | ||
| stestr run --slowest --abbreviate | ||
| env: | ||
| QISKIT_PARALLEL: FALSE | ||
| QISKIT_IGNORE_USER_SETTINGS: TRUE | ||
| RUST_BACKTRACE: 1 | ||
| - name: Filter stestr history | ||
| run: | | ||
| set -e | ||
| pushd .stestr | ||
| ls | grep -e '^[[:digit:]]' | xargs -n1 rm -f | ||
| popd | ||
| - name: Copy and Publish images | ||
| uses: actions/upload-artifact@v7 | ||
| if: ${{ failure() }} | ||
| with: | ||
| name: copied-images-${{ runner.name }}-tests-Python-${{ inputs.python-version }} | ||
| path: "**/*.png" | ||
| if-no-files-found: error | ||