test_dev #1193
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: test_dev | |
# Controls when the workflow will run | |
on: | |
pull_request: | |
branches: | |
- dev | |
# Manual trigger | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
test-dev: | |
runs-on: ubuntu-latest | |
if : ${{ github.event.pull_request.head.repo.fork == false }} # runs only when fork==false | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.8 | |
- name: Log in with Azure | |
uses: azure/login@v1 | |
with: | |
creds: '${{ secrets.AZURE_CREDENTIALS }}' | |
- name: Install OpenQAOA | |
run: | | |
python -m pip install --user virtualenv | |
python -m venv env | |
source env/bin/activate | |
python -m pip install --upgrade pip | |
make dev-install-tests_cplex | |
pip install ipykernel | |
- name: Setup IBMQ account | |
env: | |
IBMQ_TOKEN: ${{ secrets.IBMQ_TOKEN }} | |
run: | | |
IBMQ_TOKEN=$IBMQ_TOKEN | |
source env/bin/activate | |
python -c'from qiskit_ibm_provider import IBMProvider; import os; IBMProvider.save_account(os.environ.get("IBMQ_TOKEN"))' | |
- name: Setup AWS | |
env: | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
run: | | |
python -m pip install awscli | |
aws configure set aws_access_key_id $AWS_ACCESS_KEY | |
aws configure set aws_secret_access_key $AWS_SECRET_KEY | |
aws configure set region us-west-1 | |
aws configure set output json | |
- name: Build the docker stack | |
run: | | |
docker login -u AWS -p $(aws ecr get-login-password --region us-east-1) 292282985366.dkr.ecr.us-east-1.amazonaws.com | |
docker network create local_bridge | |
docker build -t amazon-braket-oq-dev . | |
docker-compose up -d | |
- name: Run tests | |
run: | | |
source env/bin/activate | |
ipython kernel install --name "env" --user | |
pytest tests/ src/*/tests -m 'not (qpu or sim)' --cov -n auto | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
files: ./coverage.xml | |
docs: | |
runs-on: ubuntu-latest | |
if : github.event.pull_request.draft == false && github.event.pull_request.head.repo.fork == false | |
steps: | |
- name: Check out openqaoa | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.8 | |
- name: Install OpenQAOA | |
run: | | |
python -m pip install --upgrade pip | |
make dev-install-docs | |
- name: Install qvm | |
run: | | |
find /usr/lib -name "libffi.so*" | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so /usr/lib/x86_64-linux-gnu/libffi.so.6 | |
wget -q https://downloads.rigetti.com/qcs-sdk/forest-sdk-2.23.0-linux-deb.tar.bz2 | |
tar -xf forest-sdk-2.23.0-linux-deb.tar.bz2 | |
cd forest-sdk-2.23.0-linux-deb/ | |
sudo apt-get update | |
sudo apt-get install -y screen libblas-dev libblas3 libgfortran5 liblapack-dev liblapack3 | |
sudo ./forest-sdk-2.23.0-linux-deb.run | |
qvm --version | |
quilc --version | |
echo "Starting qvm and quilc" | |
screen -d -m qvm -S | |
screen -d -m quilc -S | |
cd .. | |
- name: Build and test Sphinx docs | |
run: | | |
sudo apt-get install pandoc | |
mkdir ./docs/source/notebooks | |
cp ./examples/*.ipynb ./docs/source/notebooks/ | |
cd docs/ | |
make html SPHINXOPTS="-W --keep-going" |