Skip to content

Commit beac746

Browse files
authored
Merge branch 'master' into mhucka-update-pylint
2 parents e37baad + 4467aba commit beac746

File tree

5 files changed

+175
-35
lines changed

5 files changed

+175
-35
lines changed

.github/workflows/ci.yaml renamed to .github/workflows/ci-build-checks.yaml

+1-33
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,7 @@ name: Continuous Integration
22

33
on: [pull_request]
44

5-
65
jobs:
7-
lint:
8-
name: Lint check
9-
runs-on: ubuntu-20.04
10-
steps:
11-
- uses: actions/checkout@v1
12-
- uses: actions/setup-python@v1
13-
with:
14-
python-version: '3.10'
15-
architecture: 'x64'
16-
- name: Install Lint tools
17-
run: pip install --upgrade pip setuptools; pip install -r requirements.txt;
18-
- name: Lint All
19-
run: ./scripts/lint_all.sh
20-
21-
format:
22-
name: Formatting check
23-
runs-on: ubuntu-20.04
24-
25-
steps:
26-
- uses: actions/checkout@v1
27-
- uses: actions/setup-python@v1
28-
with:
29-
python-version: '3.10'
30-
architecture: 'x64'
31-
- name: Install Format tools
32-
run: pip install --upgrade pip setuptools; pip install -r requirements.txt; sudo apt-get install -y clang-format-6.0
33-
- name: Format Check
34-
run: ./scripts/format_check.sh
35-
366
wheel-build:
377
name: Wheel test
388
runs-on: ubuntu-20.04
@@ -55,7 +25,6 @@ jobs:
5525
bazel-tests:
5626
name: Library tests
5727
runs-on: ubuntu-20.04
58-
needs: [lint, format]
5928

6029
steps:
6130
- uses: actions/checkout@v1
@@ -78,7 +47,6 @@ jobs:
7847
# leak-tests:
7948
# name: Memory Leak tests
8049
# runs-on: ubuntu-20.04
81-
# needs: [lint, format]
8250
#
8351
# steps:
8452
# - uses: actions/checkout@v1
@@ -96,7 +64,7 @@ jobs:
9664
tutorials-test:
9765
name: Tutorial tests
9866
runs-on: ubuntu-20.04
99-
needs: [lint, format, wheel-build]
67+
needs: wheel-build
10068

10169
steps:
10270
- uses: actions/checkout@v1

.github/workflows/ci-file-checks.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI file checks
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
lint:
7+
name: Lint check
8+
runs-on: ubuntu-20.04
9+
steps:
10+
- uses: actions/checkout@v1
11+
- uses: actions/setup-python@v1
12+
with:
13+
python-version: '3.10'
14+
architecture: 'x64'
15+
- name: Install Lint tools
16+
run: pip install --upgrade pip setuptools; pip install -r requirements.txt;
17+
- name: Lint All
18+
run: ./scripts/lint_all.sh
19+
20+
format:
21+
name: Formatting check
22+
runs-on: ubuntu-20.04
23+
24+
steps:
25+
- uses: actions/checkout@v1
26+
- uses: actions/setup-python@v1
27+
with:
28+
python-version: '3.10'
29+
architecture: 'x64'
30+
- name: Install Format tools
31+
run: pip install --upgrade pip setuptools; pip install -r requirements.txt; sudo apt-get install -y clang-format-6.0
32+
- name: Format Check
33+
run: ./scripts/format_check.sh
34+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Summary: TFQ nightly full build & test.
2+
#
3+
# This workflow compiles TFQ and runs all test cases, to verify everything
4+
# works. Unlike the CI checks invoked on PRs and similar events, this workflow
5+
# builds everything without caching and runs the full test suite, including
6+
# "eternal" tests that take a long time to run. It is meant to guard against
7+
# failures that might be missed when skipping the long-running tests or using
8+
# caching to speed up the CI runs.
9+
#
10+
# For efficiency, it checks if there have been any commits in the past 24 hrs
11+
# and does not proceed if there have been none.
12+
#
13+
# This workflow also can be invoked manually via the "Run workflow" button at
14+
# https://github.com/tensorflow/quantum/actions/workflows/ci-build-checks.yaml
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
17+
name: CI nightly test
18+
run-name: Continuous integration nightly build & test
19+
20+
on:
21+
schedule:
22+
- cron: "15 6 * * *"
23+
24+
workflow_dispatch:
25+
inputs:
26+
py_version:
27+
description: "Python version:"
28+
type: string
29+
default: "3.10.15"
30+
31+
save_artifacts:
32+
description: Make Bazel artifacts downloadable
33+
type: boolean
34+
default: true
35+
36+
env:
37+
# Default Python version to use.
38+
py_version: "3.10.15"
39+
40+
# Additional .bazelrc options to use.
41+
bazelrc_additions: |
42+
common --announce_rc
43+
build --subcommands
44+
build --auto_output_filter=none
45+
build --show_progress_rate_limit=1
46+
build --verbose_failures
47+
test --test_output=errors
48+
test --test_summary=detailed
49+
test --test_timeout=6000
50+
test --test_verbose_timeout_warnings
51+
52+
concurrency:
53+
# Cancel any previously-started but still active runs on the same branch.
54+
cancel-in-progress: true
55+
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
56+
57+
jobs:
58+
Decision:
59+
runs-on: ubuntu-24.04
60+
outputs:
61+
run: ${{steps.commits.outputs.count > 0}}
62+
steps:
63+
- name: Check out a sparse copy of the git repo for TFQ
64+
uses: actions/checkout@v4
65+
with:
66+
sparse-checkout: .
67+
68+
- name: Get number of commits in the last 24 hrs
69+
id: commits
70+
run: |
71+
set -x
72+
count=$(git log --oneline --since '24 hours ago' | wc -l)
73+
echo "count=$count" >> "$GITHUB_OUTPUT"
74+
75+
Nightly:
76+
if: needs.Decision.outputs.run == 'true'
77+
name: Build and test
78+
needs: Decision
79+
runs-on: ubuntu-20.04
80+
steps:
81+
- name: Check out a copy of the TFQ git repository
82+
uses: actions/checkout@v4
83+
84+
- name: Set up Python ${{inputs.py_version || env.py_version}}
85+
uses: actions/setup-python@v5
86+
with:
87+
python-version: ${{inputs.py_version || env.py_version}}
88+
89+
- name: Set up Bazel
90+
uses: bazel-contrib/[email protected]
91+
with:
92+
bazelrc: ${{env.bazelrc_additions}}
93+
94+
- name: Build wheel
95+
run: |
96+
set -x
97+
pip install --upgrade pip setuptools wheel
98+
# The next script does a pip install, configure, & bazel build.
99+
./scripts/build_pip_package_test.sh
100+
101+
- name: Test wheel
102+
run: |
103+
set -x
104+
./scripts/run_example.sh
105+
106+
- name: Test rest of TFQ
107+
run: |
108+
set -x -o pipefail
109+
./scripts/test_all.sh 2>&1 | tee test_all.log
110+
111+
- name: Test tutorials
112+
run: |
113+
set -x -o pipefail
114+
pip install jupyter
115+
pip install nbclient==0.6.5 jupyter-client==6.1.12 ipython==7.22.0
116+
pip install ipykernel==5.1.1
117+
pip install gym==0.24.1
118+
pip install seaborn==0.12.0
119+
pip install -q git+https://github.com/tensorflow/docs
120+
cd ..
121+
python quantum/scripts/test_tutorials.py 2>&1 | \
122+
tee quantum/test_tutorials.log
123+
124+
- if: failure() || inputs.save_artifacts == 'true'
125+
name: Make artifacts downloadable
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: test-artifacts
129+
retention-days: 7
130+
include-hidden-files: true
131+
path: |
132+
test_all.log
133+
test_tutorials.log
134+
/home/runner/.bazel/execroot/__main__/bazel-out/
135+
!/home/runner/.bazel/execroot/__main__/bazel-out/**/*.so
136+
!/home/runner/.bazel/execroot/__main__/bazel-out/**/*.o
137+
!/home/runner/.bazel/execroot/__main__/bazel-out/**/_objs
138+
!/home/runner/.bazel/execroot/__main__/bazel-out/**/_solib_k8

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ sympy==1.12
44
numpy==1.24.2 # TensorFlow can detect if it was built against other versions.
55
nbformat==5.1.3
66
pylint==3.3.3
7-
yapf==0.40.2
7+
yapf==0.43.0
88
tensorflow==2.15.0

tensorflow_quantum/python/layers/high_level/noisy_controlled_pqc_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def test_controlled_pqc_symbols_property(self):
146146
sample_based=False)
147147
self.assertEqual(layer.symbols, [a, b, c, d])
148148

149-
@parameterized.parameters([{'sample_based': True, 'sample_based': False}])
149+
@parameterized.parameters([{'sample_based': True}, {'sample_based': False}])
150150
def test_controlled_pqc_simple_learn(self, sample_based):
151151
"""Test a simple learning scenario using analytic and sample expectation
152152
on many backends."""

0 commit comments

Comments
 (0)