Skip to content

Commit 4467aba

Browse files
authored
Add workflow for nightly full test (#853)
This workflow does a plain TFQ build & test. It's scheduled to run every night. Its purpose is to guard against failures that might be missed when skipping the long-running tests or using caching to speed up the CI runs. 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.
2 parents 309e737 + 340566f commit 4467aba

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed
Lines changed: 138 additions & 0 deletions
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/setup-bazel@0.9.1
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

0 commit comments

Comments
 (0)