-
Notifications
You must be signed in to change notification settings - Fork 653
158 lines (137 loc) · 5.29 KB
/
ci-nightly-build-test.yaml
File metadata and controls
158 lines (137 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Copyright 2025 The TensorFlow Quantum Authors
#
# 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.
# Summary: TFQ nightly full build & test.
#
# This workflow compiles TFQ and runs all test cases, to verify everything
# works. Unlike the CI checks invoked on PRs and similar events, this workflow
# builds everything without caching and runs the full test suite, including
# "eternal" tests that take a long time to run. It is meant to guard against
# failures that might be missed when skipping the long-running tests or using
# caching to speed up the CI runs.
#
# For efficiency, it checks if there have been any commits in the past 24 hrs
# and does not proceed if there have been none.
#
# This workflow also can be invoked manually via the "Run workflow" button at
# https://github.com/tensorflow/quantum/actions/workflows/ci-build-checks.yaml
# yamllint disable rule:line-length
name: CI nightly full test
run-name: Continuous integration nightly build & test
on:
schedule:
- cron: "15 6 * * *"
workflow_dispatch:
inputs:
py_version:
description: "Python version:"
type: string
default: "3.10.15"
save_artifacts:
description: Make Bazel artifacts downloadable
type: boolean
default: true
env:
# Default Python version to use.
py_version: "3.10.15"
# Additional .bazelrc options to use.
bazelrc_additions: |
common --announce_rc
build --subcommands
build --auto_output_filter=none
build --show_progress_rate_limit=1
build --verbose_failures
test --test_output=errors
test --test_summary=detailed
test --test_timeout=6000
test --test_verbose_timeout_warnings
concurrency:
# Cancel any previously-started but still active runs on the same branch.
cancel-in-progress: true
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
permissions: read-all
defaults:
run:
shell: bash -x {0}
jobs:
Decision:
runs-on: ubuntu-24.04
outputs:
run: ${{steps.commits.outputs.count > 0}}
steps:
- name: Check out a sparse copy of the git repo for TFQ
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: .
- name: Get number of commits in the last 24 hrs
id: commits
run: |
count=$(git log --oneline --since '24 hours ago' | wc -l)
echo "count=$count" >> "$GITHUB_OUTPUT"
Nightly:
if: needs.Decision.outputs.run == 'true'
name: Build and test
needs: Decision
container:
image: us-docker.pkg.dev/ml-oss-artifacts-published/ml-public-container/ml-build:infrastructure-public-image-82c7ac59ba4b
runs-on: linux-x86-n2-32
steps:
- name: Check out a copy of the TFQ git repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{inputs.py_version || env.py_version}}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{inputs.py_version || env.py_version}}
- name: Set up Bazel
uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
bazelrc: ${{env.bazelrc_additions}}
- name: Build wheel
run: |
pip install --upgrade pip setuptools wheel
# The next script does a pip install, configure, & bazel build.
./scripts/build_pip_package_test.sh
- name: Test wheel
run: |
./scripts/run_example.sh
- name: Test rest of TFQ
run: |
set -o pipefail
./scripts/test_all.sh 2>&1 | tee test_all.log
- name: Test tutorials
run: |
set -o pipefail
pip install jupyter
pip install nbclient==0.6.5 jupyter-client==6.1.12 ipython==7.22.0
pip install ipykernel==5.1.1
pip install gymnasium[classic-control]==1.2.3
pip install seaborn==0.12.0
pip install -q git+https://github.com/tensorflow/docs
cd ..
python quantum/scripts/test_tutorials.py 2>&1 | \
tee quantum/test_tutorials.log
- if: failure() || inputs.save_artifacts == 'true'
name: Make artifacts downloadable
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-artifacts
retention-days: 7
include-hidden-files: true
path: |
test_all.log
test_tutorials.log
/home/runner/.bazel/execroot/__main__/bazel-out/
!/home/runner/.bazel/execroot/__main__/bazel-out/**/*.so
!/home/runner/.bazel/execroot/__main__/bazel-out/**/*.o
!/home/runner/.bazel/execroot/__main__/bazel-out/**/_objs
!/home/runner/.bazel/execroot/__main__/bazel-out/**/_solib_k8