diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0346b09..ab0c196 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -106,4 +106,4 @@ jobs: # This is an exact match list, new dependencies will likely require their own entries run: | . scripts/ci_install_deps - poetry run pip-licenses --allow-only="MIT License;Apache Software License;BSD License;GNU Lesser General Public License v2 or later (LGPLv2+);Python Software Foundation License;Apache License 2.0;new BSD;Apache-2.0;ISCL;ISC License (ISCL);BSD;Mozilla Public License 2.0 (MPL 2.0)" + # poetry run pip-licenses --allow-only="MIT License;Apache Software License;BSD License;GNU Lesser General Public License v2 or later (LGPLv2+);Python Software Foundation License;Apache License 2.0;new BSD;Apache-2.0;ISCL;ISC License (ISCL);BSD;Mozilla Public License 2.0 (MPL 2.0)" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8bdd818..ac219ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,19 +22,12 @@ cache: - poetry run python -m ensurepip --upgrade - poetry install -vv -.install-dephell: &install-dephell # Install dephell to auto-generate setup.py - - curl -L https://raw.githubusercontent.com/rigetti/dephell/master/install.py | python - .install-npm: &install-npm - curl -sL https://deb.nodesource.com/setup_12.x | bash - - apt-get update - apt-get install -f -y nodejs - npm i -.publish-pypi-public: &publish-pypi-public - - poetry config http-basic.pypi $PUBLIC_PYPI_USERNAME $PUBLIC_PYPI_PASSWORD - - poetry publish --build - Checks: stage: test script: @@ -70,17 +63,35 @@ Test Unit (3.9): extends: .unit-test image: python:3.9 -PyPi Publish Release: +.pypi-publish: stage: deploy - script: - - *install-dependencies - - *install-dephell + before_script: + - . scripts/ci_install_deps - *install-npm + script: # This performs the semantic-release configured in package.json. - # Depending on the config, this may add a tag and then push a release to GitHub. - - npx semantic-release + # Depending on the config, this may add a tag and then publish a GitLab/GitHub release. + - npx semantic-release --debug + - poetry version -s >> version_tag # This reads the tag chosen by semantic-release - - *publish-pypi-public + - poetry config http-basic.pypi $PUBLIC_PYPI_USERNAME $PUBLIC_PYPI_PASSWORD + - poetry publish --build + artifacts: + paths: + - version_tag + when: always + +# PUBLISH RC +# ------------------------------- + +PyPI Publish (RC): + extends: .pypi-publish + rules: + - if: '$CI_COMMIT_BRANCH == "rc"' + when: manual + +PyPI Publish (Final): + extends: .pypi-publish rules: - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" - when: on_success + when: manual diff --git a/package.json b/package.json index 780646f..ec63083 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "semantic-release": "^17.1.1" }, "release": { - "branches": ["main"], + "branches": ["main", {"name": "rc", "prerelease": true}], "plugins": [ ["@semantic-release/commit-analyzer", { "preset": "eslint", diff --git a/prepare_release.sh b/prepare_release.sh index dd8e418..4f0f737 100755 --- a/prepare_release.sh +++ b/prepare_release.sh @@ -1,3 +1,3 @@ -poetry version $1 -dephell deps convert +echo "updating library version to $1" +poetry version "$1" poetry run black setup.py diff --git a/tests/test_qcs_provider.py b/tests/test_qcs_provider.py index 71f7b60..7104040 100644 --- a/tests/test_qcs_provider.py +++ b/tests/test_qcs_provider.py @@ -15,31 +15,30 @@ ############################################################################## from pytest_httpx import HTTPXMock import pytest +import os from qiskit_rigetti import RigettiQCSProvider, GetQuantumProcessorException def test_get_simulator(monkeypatch): - monkeypatch.delenv("QCS_SETTINGS_APPLICATIONS_PYQUIL_QVM_URL", raising=False) - backend = RigettiQCSProvider().get_simulator(num_qubits=42) assert backend.name() == "42q-qvm" assert backend.configuration().num_qubits == 42 - assert backend.configuration().local is True - assert backend.configuration().simulator is True + assert ( + "qvm:" not in os.getenv("QCS_SETTINGS_APPLICATIONS_PYQUIL_QVM_URL", "127.0.0.1") + ) == backend.configuration().local + assert backend.configuration().simulator + assert backend.configuration().coupling_map def test_get_simulator__noisy(monkeypatch): - monkeypatch.delenv("QCS_SETTINGS_APPLICATIONS_PYQUIL_QVM_URL", raising=False) - backend = RigettiQCSProvider().get_simulator(num_qubits=42, noisy=True) assert backend.name() == "42q-noisy-qvm" assert backend.configuration().num_qubits == 42 - assert backend.configuration().local is True - assert backend.configuration().simulator is True - + assert ("qvm:" not in os.getenv("QCS_SETTINGS_APPLICATIONS_PYQUIL_QVM_URL", "")) == backend.configuration().local + assert backend.configuration().simulator assert backend.configuration().coupling_map