Skip to content

Continuous integration build and test #337

Continuous integration build and test

Continuous integration build and test #337

# 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.
name: 'CI: build & test'
run-name: Continuous integration build and test
on:
pull_request:
branches:
- master
merge_group:
types:
- checks_requested
concurrency:
cancel-in-progress: true
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
permissions: read-all
jobs:
wheel-build:
name: Wheel test
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
with:
python-version: '3.10'
architecture: 'x64'
cache: pip
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
- name: Build Wheel Test
run: ./scripts/build_pip_package_test.sh
- name: Test Wheel
run: ./scripts/run_example.sh
bazel-tests:
name: Library tests
runs-on: linux-x86-n2-32
container:
image: us-docker.pkg.dev/ml-oss-artifacts-published/ml-public-container/ml-build:latest
timeout-minutes: 60
steps:
- name: Adjust the ml-build runner to our needs
run: |
# lsb-release (needed by setup-python) is missing in ml-build runners
sudo apt-get update && sudo apt-get install -y lsb-release
# This file, though it's empty, hangs the Bazel install step.
rm -f /etc/bazel.bazelrc
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
with:
python-version: '3.10'
architecture: 'x64'
cache: pip
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
- name: Configure CI TF
run: echo "Y\n" | ./configure.sh
- name: Full Library Test
run: ./scripts/test_all.sh
# 2024-11-30 [mhucka] temporarily turning off leak-tests because it produces
# false positives on GH that we can't immediately address. TODO: if updating
# TFQ to use Clang and the latest TF does not resolve this, find a way to
# skip the handful of failing tests and renable the rest of the msan tests.
#
# leak-tests:
# name: Memory Leak tests
# runs-on: ubuntu-22.04
#
# steps:
# - uses: actions/checkout@v1
# - uses: actions/setup-python@v1
# with:
# python-version: '3.10'
# architecture: 'x64'
# - name: Install Bazel on CI
# run: ./scripts/ci_install.sh
# - name: Configure CI TF
# run: echo "Y\n" | ./configure.sh
# - name: Leak Test qsim and src
# run: ./scripts/msan_test.sh
tutorials-test:
name: Tutorial tests
runs-on: linux-x86-n2-32
container:
image: us-docker.pkg.dev/ml-oss-artifacts-published/ml-public-container/ml-build:latest
timeout-minutes: 60
steps:
- name: Adjust the ml-build runner to our needs
run: |
# lsb-release (needed by setup-python) is missing in ml-build runners
sudo apt-get update && sudo apt-get install -y lsb-release
# This file, though it's empty, hangs the Bazel install step.
rm -f /etc/bazel.bazelrc
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
with:
python-version: '3.10'
architecture: 'x64'
cache: pip
- name: Install notebook dependencies
run: pip install --upgrade pip seaborn==0.10.0
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
- name: Build Wheel
run: ./scripts/build_pip_package_test.sh
- name: Test Notebooks
run: ./scripts/ci_validate_tutorials.sh