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
- # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16
1
# Summary: GitHub CI workflow for testing TFQ against Cirq releases
17
2
#
18
3
# This workflow is executed every night on a schedule. By default, this
19
4
# workflow will save Bazel build artifacts if an error occurs during a run.
20
5
#
21
6
# 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
23
8
# Clicking the "Run workflow" button there will present a form interface with
24
9
# options for overridding some of the parameters for the run.
25
10
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26
11
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
42
14
43
15
on :
44
- # Nightly runs.
45
16
schedule :
46
- - cron : 0 0 * * *
17
+ - cron : " 10 7 * * *"
18
+
47
19
# Manual on-demand invocations.
48
20
workflow_dispatch :
49
21
inputs :
50
22
py_version :
51
23
description : Version of Python to use
24
+ type : string
25
+ default : " 3.10.15"
26
+
52
27
bazel_version :
53
28
description : Version of Bazel Python to use
29
+ type : string
30
+
54
31
arch :
55
32
description : Computer architecture to use
33
+ type : string
34
+ default : " x64"
35
+
56
36
use_bazel_disk_cache :
57
- description : Use Bazel disk_cache between runs?
37
+ description : Use Bazel disk_cache between runs
58
38
type : boolean
59
39
default : true
40
+
60
41
cache_bazel_tests :
61
- description : Allow Bazel to cache test results?
42
+ description : Allow Bazel to cache test results
62
43
type : boolean
63
44
default : true
45
+
64
46
save_artifacts :
65
- description : Make Bazel build outputs downloadable?
47
+ description : Make Bazel outputs downloadable
66
48
type : boolean
67
49
default : true
68
50
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
+
69
72
jobs :
70
73
test-compatibility :
71
74
name : Run TFQ tests
@@ -74,12 +77,12 @@ jobs:
74
77
- name : Check out a copy of the TFQ git repository
75
78
uses : actions/checkout@v4
76
79
77
- - name : Set up Python
80
+ - name : Set up Python ${{inputs.py_version || env.py_version}}
78
81
id : python
79
82
uses : actions/setup-python@v5
80
83
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}}
83
86
cache : pip
84
87
85
88
- name : Install TensorFlow Quantum dependencies
@@ -110,9 +113,9 @@ jobs:
110
113
111
114
- name : Set up Bazel with caching
112
115
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
114
117
env :
115
- USE_BAZEL_VERSION : ${{github.event. inputs.bazel_version || env.bazel_version}}
118
+ USE_BAZEL_VERSION : ${{inputs.bazel_version || env.bazel_version}}
116
119
with :
117
120
disk-cache : ${{github.workflow}}
118
121
bazelisk-cache : true
@@ -124,17 +127,17 @@ jobs:
124
127
125
128
- name : Set up Bazel without caching
126
129
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
128
131
env :
129
- USE_BAZEL_VERSION : ${{github.event. inputs.bazel_version || env.bazel_version}}
132
+ USE_BAZEL_VERSION : ${{inputs.bazel_version || env.bazel_version}}
130
133
with :
131
134
bazelrc : |
132
135
${{env.bazelrc_additions}}
133
136
test --cache_test_results=${{env.cache_bazel_tests}}
134
137
135
138
- name : Configure TFQ
136
139
run : |
137
- set -x -e
140
+ set -x
138
141
# Save information to the run log, in case it's needed for debugging.
139
142
which python
140
143
python --version
@@ -148,7 +151,7 @@ jobs:
148
151
# TODO: when the msan tests are working again, replace the "touch"
149
152
# line with ./scripts/msan_test.sh 2>&1 | tee msan-tests-output.log
150
153
run : |
151
- set -x -e
154
+ set -x -o pipefail
152
155
./scripts/test_all.sh 2>&1 | tee main-tests-output.log
153
156
touch msan-tests-output.log
154
157
0 commit comments