1- # Copyright 2024 The TensorFlow Quantum Authors
2- #
3- # Licensed under the Apache License, Version 2.0 (the "License");
4- # you may not use this file except in compliance with the License.
5- # You may obtain a copy of the License at
6- #
7- # http://www.apache.org/licenses/LICENSE-2.0
8- #
9- # Unless required by applicable law or agreed to in writing, software
10- # distributed under the License is distributed on an "AS IS" BASIS,
11- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12- # See the License for the specific language governing permissions and
13- # limitations under the License.
14-
15- # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161# Summary: GitHub CI workflow for testing TFQ against Cirq releases
172#
183# This workflow is executed every night on a schedule. By default, this
194# workflow will save Bazel build artifacts if an error occurs during a run.
205#
216# For testing, this workflow can be invoked manually from the GitHub page at
22- # https://github.com/tensorflow/quantum/actions/workflows/cirq_compatibility .yaml
7+ # https://github.com/tensorflow/quantum/actions/workflows/ci-nightly-cirq-test .yaml
238# Clicking the "Run workflow" button there will present a form interface with
249# options for overridding some of the parameters for the run.
2510# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2611
27- name : Cirq compatibility tests
28-
29- # Default values. These can be overridden when workflow dispatch is used.
30- env :
31- # Python version to test against.
32- py_version : ' 3.10'
33- # Bazel version. Note: this needs to match what is used in TF & TFQ.
34- bazel_version : 6.5.0
35- # Machine architecture.
36- arch : x64
37- # Additional .bazelrc options to use.
38- bazelrc_additions : |
39- common --announce_rc
40- build --verbose_failures
41- test --test_timeout=3000
12+ name : CI nightly Cirq test
13+ run-name : Continuous integration Cirq compatibility test
4214
4315on :
44- # Nightly runs.
4516 schedule :
46- - cron : 0 0 * * *
17+ - cron : " 10 7 * * *"
18+
4719 # Manual on-demand invocations.
4820 workflow_dispatch :
4921 inputs :
5022 py_version :
5123 description : Version of Python to use
24+ type : string
25+ default : " 3.10.15"
26+
5227 bazel_version :
5328 description : Version of Bazel Python to use
29+ type : string
30+
5431 arch :
5532 description : Computer architecture to use
33+ type : string
34+ default : " x64"
35+
5636 use_bazel_disk_cache :
57- description : Use Bazel disk_cache between runs?
37+ description : Use Bazel disk_cache between runs
5838 type : boolean
5939 default : true
40+
6041 cache_bazel_tests :
61- description : Allow Bazel to cache test results?
42+ description : Allow Bazel to cache test results
6243 type : boolean
6344 default : true
45+
6446 save_artifacts :
65- description : Make Bazel build outputs downloadable?
47+ description : Make Bazel outputs downloadable
6648 type : boolean
6749 default : true
6850
51+ env :
52+ # Default Python version to use.
53+ py_version : " 3.10.15"
54+
55+ # Bazel version. Note: this needs to match what is used in TF & TFQ.
56+ bazel_version : 6.5.0
57+
58+ # Machine architecture to use.
59+ arch : x64
60+
61+ # Additional .bazelrc options to use.
62+ bazelrc_additions : |
63+ common --announce_rc
64+ build --verbose_failures
65+ test --test_timeout=3000
66+
67+ concurrency :
68+ # Cancel any previously-started but still active runs on the same branch.
69+ cancel-in-progress : true
70+ group : ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
71+
6972jobs :
7073 test-compatibility :
7174 name : Run TFQ tests
@@ -74,12 +77,12 @@ jobs:
7477 - name : Check out a copy of the TFQ git repository
7578 uses : actions/checkout@v4
7679
77- - name : Set up Python
80+ - name : Set up Python ${{inputs.py_version || env.py_version}}
7881 id : python
7982 uses : actions/setup-python@v5
8083 with :
81- python-version : ${{github.event. inputs.py_version || env.py_version}}
82- architecture : ${{github.event. inputs.arch || env.arch}}
84+ python-version : ${{inputs.py_version || env.py_version}}
85+ architecture : ${{inputs.arch || env.arch}}
8386 cache : pip
8487
8588 - name : Install TensorFlow Quantum dependencies
@@ -110,9 +113,9 @@ jobs:
110113
111114 - name : Set up Bazel with caching
112115 if : env.use_bazel_disk_cache == 'true'
113- uses : bazel-contrib/setup-bazel@0.9 .1
116+ uses : bazel-contrib/setup-bazel@0.12 .1
114117 env :
115- USE_BAZEL_VERSION : ${{github.event. inputs.bazel_version || env.bazel_version}}
118+ USE_BAZEL_VERSION : ${{inputs.bazel_version || env.bazel_version}}
116119 with :
117120 disk-cache : ${{github.workflow}}
118121 bazelisk-cache : true
@@ -124,17 +127,17 @@ jobs:
124127
125128 - name : Set up Bazel without caching
126129 if : env.use_bazel_disk_cache == 'false'
127- uses : bazel-contrib/setup-bazel@0.9 .1
130+ uses : bazel-contrib/setup-bazel@0.12 .1
128131 env :
129- USE_BAZEL_VERSION : ${{github.event. inputs.bazel_version || env.bazel_version}}
132+ USE_BAZEL_VERSION : ${{inputs.bazel_version || env.bazel_version}}
130133 with :
131134 bazelrc : |
132135 ${{env.bazelrc_additions}}
133136 test --cache_test_results=${{env.cache_bazel_tests}}
134137
135138 - name : Configure TFQ
136139 run : |
137- set -x -e
140+ set -x
138141 # Save information to the run log, in case it's needed for debugging.
139142 which python
140143 python --version
@@ -148,7 +151,7 @@ jobs:
148151 # TODO: when the msan tests are working again, replace the "touch"
149152 # line with ./scripts/msan_test.sh 2>&1 | tee msan-tests-output.log
150153 run : |
151- set -x -e
154+ set -x -o pipefail
152155 ./scripts/test_all.sh 2>&1 | tee main-tests-output.log
153156 touch msan-tests-output.log
154157
0 commit comments