Be explicit about openqasm3.ast imports #94
This file contains 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: Reference Python Package | |
on: | |
[push, pull_request] | |
jobs: | |
build: | |
uses: ./.github/workflows/build-ast.yml | |
tests: | |
name: OpenPulse AST tests | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
# Just using minimum and maximum to avoid exploding the matrix. | |
python-version: ['3.7', '3.12'] | |
antlr-version: ['4.7', '4.13'] | |
defaults: | |
run: | |
working-directory: source/openpulse | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: openpulse-python-wheel | |
path: ./source/openpulse/ | |
- name: Install package | |
run: | | |
set -e | |
pip install --upgrade pip wheel | |
pip install -r requirements-dev.txt | |
pip install 'antlr4_python3_runtime==${{ matrix.antlr-version }}' | |
pip install "$(echo openpulse-*.whl)[all]" | |
- name: Check openpulse format | |
run: black --check --diff openpulse tests | |
- name: Check openpulse style | |
working-directory: source/openpulse/openpulse | |
run: pylint . | |
- name: Check openpulse tests style | |
working-directory: source/openpulse/tests | |
run: pylint . | |
- name: Run openpulse tests | |
run: | | |
# Swap into the testing directory so the imported `openpulse` is the | |
# wheel version not the current-directory version. The | |
# `--import-mode=importlib` stops pytest from modifying the path to | |
# accidentally put the checked-out version (with no ANTLR) back. | |
cd tests | |
pytest -vv --color=yes --import-mode=importlib . |