Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 2024-05/some-gwr
Browse files Browse the repository at this point in the history
  • Loading branch information
mpharrigan committed Aug 6, 2024
2 parents 8c72047 + 6a4b920 commit 275842f
Show file tree
Hide file tree
Showing 493 changed files with 34,942 additions and 10,074 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Mark generated protobuf files to be collapsed by default in PRs
# See: https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github
*_pb2.py linguist-generated=true
*_pb2.pyi linguist-generated=true
20 changes: 18 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
pip install -r dev_tools/requirements/envs/pytest.env.txt
pip install --no-deps -e .
- run: |
check/pytest -m 'not notebooks'
check/pytest -m 'not notebook and not slow'
pytest-dev-tools:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
pip install --no-deps -e .
- run: |
check/pylint
mypy:
runs-on: ubuntu-latest
steps:
Expand All @@ -116,3 +116,19 @@ jobs:
pip install --no-deps -e .
- run: |
check/mypy
autogenerate-notebooks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ts-graphviz/setup-graphviz@v1
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev_tools/requirements/envs/docs.env.txt
pip install --no-deps -e .
- run: |
check/autogenerate-notebooks
34 changes: 34 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Nightly tests

on:
schedule:
- cron: "0 11 * * 1-5" # Mon-Fri at 11:00 AM UTC

jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ts-graphviz/setup-graphviz@v1
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev_tools/requirements/envs/pytest.env.txt
pip install --no-deps -e .
- run: |
check/pytest
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,7 @@ dmypy.json
# files that get generated when testing
mod_exp_bloq.json
mod_exp_cbloq.json
musical_score_example.json
musical_score_example.json

# Jupyter
jupyter_kernel.lock
20 changes: 20 additions & 0 deletions check/autogenerate-notebooks
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

################################################################################
# Autogenerates the notebooks and reports whether there were any changes.
#
# Usage:
# check/autogenerate-notebooks
#
################################################################################

python dev_tools/autogenerate-bloqs-notebooks-v2.py || exit $?

if output=$(git status --porcelain) && [ -z "$output" ]; then
# Working directory clean
exit 0
else
# Uncommitted changes
echo $output
exit 1
fi
6 changes: 3 additions & 3 deletions check/pylint-changed-files
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ else
echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/main' or 'HEAD~1').\033[0m" >&2
exit 1
fi
base="$(git merge-base ${rev} HEAD)"
if [ "$(git rev-parse ${rev})" == "${base}" ]; then
base="$(git merge-base "${rev}" HEAD)"
if [ "$(git rev-parse "${rev}")" == "${base}" ]; then
echo -e "Comparing against revision '${rev}'." >&2
else
echo -e "Comparing against revision '${rev}' (merge base ${base})." >&2
rev="${base}"
fi

typeset -a changed
IFS=$'\n' read -r -d '' -a changed < <(git diff --name-only "${rev}" -- '*.py')
IFS=$'\n' read -r -d '' -a changed < <(git diff --diff-filter=d --name-only "${rev}" -- '*.py')

num_changed=${#changed[@]}

Expand Down
Loading

0 comments on commit 275842f

Please sign in to comment.