Skip to content

Change master -> main for qiskit-translations repo (backport #1228) #6586

Change master -> main for qiskit-translations repo (backport #1228)

Change master -> main for qiskit-translations repo (backport #1228) #6586

Workflow file for this run

# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
name: Nature Unit Tests
on:
push:
branches:
- main
- 'stable/**'
pull_request:
branches:
- main
- 'stable/**'
schedule:
# run every day at 1AM
- cron: '0 1 * * *'
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
Checks:
if: github.repository_owner == 'qiskit-community'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- name: Print Concurrency Group
env:
CONCURRENCY_GROUP: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
run: |
echo -e "\033[31;1;4mConcurrency Group\033[0m"
echo -e "$CONCURRENCY_GROUP\n"
shell: bash
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
setup.py
requirements.txt
requirements-dev.txt
- name: Create conda environment
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda create -y -n psi4env python=${{ matrix.python-version }}
shell: bash
- uses: ./.github/actions/install-main-dependencies
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
use-conda: "true"
terra-main: "false"
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-nature
with:
use-conda: "true"
- name: Install Dependencies
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
sudo apt-get install -y pandoc
sudo apt-get -y install python3-enchant
sudo apt-get -y install hunspell-en-us
pip install pyenchant
# append to reno config
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
shell: bash
- name: Set up problem matches
run: |
echo "::add-matcher::./.github/problem_matchers/copyright.json"
echo "::add-matcher::./.github/problem_matchers/spell.json"
echo "::add-matcher::./.github/problem_matchers/black.json"
- name: PIP Check
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
pip check
if: ${{ !cancelled() }}
shell: bash
- name: Copyright Check
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
python tools/check_copyright.py -check
if: ${{ !cancelled() }}
shell: bash
- name: Spell Check
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
make spell
if: ${{ !cancelled() }}
shell: bash
- name: Style Check
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
make clean_sphinx
make style
if: ${{ !cancelled() }}
shell: bash
- name: Run make html
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
make clean_sphinx
make html
cd docs/_build/html
mkdir artifacts
tar -zcvf artifacts/documentation.tar.gz --exclude=./artifacts .
if: ${{ !cancelled() }}
shell: bash
- name: Run upload documentation
uses: actions/upload-artifact@v3
with:
name: documentation
path: docs/_build/html/artifacts/documentation.tar.gz
if: ${{ !cancelled() }}
- name: Doctest
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
make doctest
if: ${{ !cancelled() }}
shell: bash
Nature:
if: github.repository_owner == 'qiskit-community'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9, '3.10', 3.11]
include:
- os: macos-latest
python-version: 3.9
- os: macos-latest
python-version: 3.11
- os: windows-2019
python-version: 3.8
- os: windows-2019
python-version: 3.11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
setup.py
requirements.txt
requirements-dev.txt
- name: Create conda environment
run: |
if [ "${{ matrix.os }}" == "macos-latest" ]; then
sudo chown -R $USER: "$CONDA"
fi
source "$CONDA/etc/profile.d/conda.sh"
if [ "${{ matrix.python-version }}" == "3.11" ]; then
conda create -y -n psi4env python=${{ matrix.python-version }} -c conda-forge
else
conda create -y -n psi4env python=${{ matrix.python-version }}
fi
shell: bash
- name: Install PSI4
uses: ./.github/actions/install-psi4
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
if: ${{ matrix.python-version != '3.11' && (matrix.os != 'windows-2019' || (matrix.os == 'windows-2019' && matrix.python-version != '3.11')) }}
- name: Install PyQuante2
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
conda install -y pyquante2_pure -c rpmuller
shell: bash
if: ${{ matrix.python-version != '3.11' }}
- uses: ./.github/actions/install-main-dependencies
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
use-conda: "true"
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-nature
with:
use-conda: "true"
- name: Set up problem matches
run: |
echo "::add-matcher::./.github/problem_matchers/pylint.json"
echo "::add-matcher::./.github/problem_matchers/mypy.json"
if: ${{ matrix.python-version == 3.7 }}
- name: Run lint
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
make lint
shell: bash
- name: Run mypy
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
make mypy
if: ${{ !cancelled() && matrix.python-version != 3.7 }}
shell: bash
- name: Run mypy on Python 3.7
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
python -m mypy --no-warn-unused-ignores qiskit_nature test tools
if: ${{ !cancelled() && matrix.python-version == 3.7 }}
shell: bash
- name: Stestr Cache
uses: actions/cache@v3
with:
path: |
.stestr
.stestr1
key: stestr-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
stestr-${{ matrix.os }}-${{ matrix.python-version }}-
stestr-${{ matrix.os }}-
if: ${{ !cancelled() }}
- name: Nature Unit Tests under Python ${{ matrix.python-version }}
uses: ./.github/actions/run-tests
with:
event-name: ${{ github.event_name }}
run-slow: ${{ contains(github.event.pull_request.labels.*.name, 'run_slow') }}
python-version: ${{ matrix.python-version }}
if: ${{ !cancelled() }}
- name: Deprecation Messages
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
mkdir ./ci-artifact-data
python tools/extract_deprecation.py -file out.txt -output ./ci-artifact-data/nat.dep
shell: bash
- name: Coverage combine
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
coverage3 combine
mv .coverage ./ci-artifact-data/nat.dat
if: ${{ matrix.python-version == 3.7 }}
shell: bash
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}
path: ./ci-artifact-data/*
- name: Nature Unit Tests without matplotlib/pyscf/psi4/pyquante2/sparse/opt_einsum under Python ${{ matrix.python-version }}
env:
PYTHONWARNINGS: default
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate psi4env
pip uninstall -y matplotlib pyscf sparse opt_einsum
if [[ "${{ matrix.python-version }}" != "3.11" && ("${{ matrix.os }}" != "windows-2019" || ("${{ matrix.os }}" == "windows-2019" && "${{ matrix.python-version }}" != "3.11")) ]]; then
echo 'Uninstall psi4'
conda remove -y --force psi4
fi
echo 'Uninstall pyquante2'
if [[ "${{ matrix.python-version }}" != "3.11" ]]; then
conda remove -y --force pyquante2_pure
fi
pip uninstall -y pyquante2
if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ contains(github.event.pull_request.labels.*.name, 'run_slow') }}" == "true" ]; then
export QISKIT_TESTS="run_slow"
fi
mkdir -p ./.stestr1
stestr --test-path test --repo-url .stestr1 run
if: ${{ !cancelled() }}
shell: bash
Tutorials:
if: github.repository_owner == 'qiskit-community'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.8, 3.11]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
setup.py
requirements.txt
requirements-dev.txt
- uses: ./.github/actions/install-main-dependencies
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
use-conda: "false"
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-nature
with:
use-conda: "false"
- name: Install Dependencies
run: |
pip install jupyter
sudo apt-get install -y pandoc
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
shell: bash
- name: Run Qiskit Nature Tutorials
env:
QISKIT_PARALLEL: False
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: |
make html
cd docs/_build/html
mkdir artifacts
tar -zcvf artifacts/tutorials.tar.gz --exclude=./artifacts .
shell: bash
- name: Run upload tutorials
uses: actions/upload-artifact@v3
with:
name: tutorials${{ matrix.python-version }}
path: docs/_build/html/artifacts/tutorials.tar.gz
- name: Run stable tutorials
env:
QISKIT_PARALLEL: False
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: |
# clean last sphinx output
make clean_sphinx
# get current version
version=$(pip show qiskit-nature | awk -F. '/^Version:/ { print substr($1,10), $2-1 }' OFS=.)
# download stable version
wget https://codeload.github.com/qiskit-community/qiskit-nature/zip/stable/$version -O /tmp/repo.zip
unzip /tmp/repo.zip -d /tmp/
# copy stable tutorials to main tutorials
cp -R /tmp/qiskit-nature-stable-$version/docs/tutorials/* docs/tutorials
# run tutorials and zip results
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
# ignore unreleased/untagged notes
tools/ignore_untagged_notes.sh
make html
cd docs/_build/html
mkdir artifacts
tar -zcvf artifacts/tutorials.tar.gz --exclude=./artifacts .
if: ${{ matrix.python-version == 3.8 && !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
shell: bash
- name: Run upload stable tutorials
uses: actions/upload-artifact@v3
with:
name: tutorials-stable${{ matrix.python-version }}
path: docs/_build/html/artifacts/tutorials.tar.gz
if: ${{ matrix.python-version == 3.8 && !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
Deprecation_Messages_and_Coverage:
if: github.repository_owner == 'qiskit-community'
needs: [Checks, Nature, Tutorials]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest-3.7
path: /tmp/u37
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest-3.8
path: /tmp/u38
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest-3.9
path: /tmp/u39
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest-3.10
path: /tmp/u310
- uses: actions/download-artifact@v3
with:
name: macos-latest-3.9
path: /tmp/m39
- uses: actions/download-artifact@v3
with:
name: macos-latest-3.11
path: /tmp/m311
- uses: actions/download-artifact@v3
with:
name: windows-2019-3.8
path: /tmp/w38
- uses: actions/download-artifact@v3
with:
name: windows-2019-3.11
path: /tmp/w311
- name: Install Dependencies
run: pip install -U coverage coveralls diff-cover
shell: bash
- name: Combined Deprecation Messages
run: |
sort -f -u /tmp/u37/nat.dep /tmp/u38/nat.dep /tmp/u39/nat.dep /tmp/u310/nat.dep /tmp/m39/nat.dep /tmp/m311/nat.dep /tmp/w38/nat.dep /tmp/w311/nat.dep || true
shell: bash
- name: Coverage combine
run: coverage3 combine /tmp/u37/nat.dat
shell: bash
- name: Upload to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github
shell: bash