Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update version of Ubuntu used in cirq_compatibility.yaml #813

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fd58f03
Update version of Ubuntu used in cirq_compatibility.yaml
mhucka Oct 31, 2024
85f22b2
Update GHA actions to use latest versions
mhucka Nov 1, 2024
cf14a09
WIP try to save logs so that they can be inspected
mhucka Nov 6, 2024
c323bba
Use latest versions of actions checkout & setup-python
mhucka Nov 6, 2024
4f99bff
WIP temporarily limit tests to msan_test during debugging
mhucka Nov 6, 2024
52b373a
WIP temporarily skip all tests but msan
mhucka Nov 6, 2024
d50e296
WIP temporarily skip all tests but msan
mhucka Nov 6, 2024
d8858ab
WIP still trying to figure out how to retain artifacts
mhucka Nov 6, 2024
c053019
WIP still trying to figure out how to retain artifacts
mhucka Nov 6, 2024
aa25ae5
WIP still trying to figure out how to retain artifacts
mhucka Nov 6, 2024
31e1249
WIP trying to understand why the action doesn't seem to do anything
mhucka Nov 6, 2024
2cd0c30
WIP trying to understand why the action doesn't seem to do anything
mhucka Nov 6, 2024
1f8c470
WIP trying to understand why the action doesn't seem to do anything
mhucka Nov 6, 2024
d3e1c19
WIP trying to understand why the action doesn't seem to do anything
mhucka Nov 6, 2024
27bb47d
WIP solved error; generate real output
mhucka Nov 6, 2024
07bdd80
WIP testing possible bug
mhucka Nov 7, 2024
568a40f
WIP testing possible bug
mhucka Nov 7, 2024
ba4d5f5
WIP revert prior incorrect change
mhucka Nov 7, 2024
64078fb
Remove unused variable
mhucka Nov 7, 2024
75f4b6b
Fix compiler warnings about wrong signedness of comparisons
mhucka Nov 7, 2024
d532e43
WIP don't need so much debug output after all
mhucka Nov 7, 2024
7eea792
Try to be smarter about caching bazel & python
mhucka Nov 7, 2024
fbd41b4
WIP Update artifact path for setup-bazel
mhucka Nov 7, 2024
57cbb05
WIP further adjust bazel flags
mhucka Nov 7, 2024
5679623
WIP try to reduce the size of the artifact
mhucka Nov 7, 2024
11e5730
WIP adjust the artifact files further
mhucka Nov 7, 2024
eadaadf
WIP adjust the output produced by bazel test
mhucka Nov 8, 2024
ecc79a8
WIP save the bazel stdout & stderr output to the artifact file
mhucka Nov 8, 2024
5dd1765
WIP fix error in file name
mhucka Nov 8, 2024
25995b1
WIP make it keep going on other tests if one fails
mhucka Nov 8, 2024
e6e9dee
WIP try some ASAN debug flags
mhucka Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 144 additions & 87 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,111 +1,168 @@
name: Continuous Integration

on: [pull_request]
on: [pull_request, workflow_dispatch]


jobs:
lint:
name: Lint check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.10'
architecture: 'x64'
- name: Install Lint tools
run: pip install --upgrade pip setuptools; pip install -r requirements.txt;
- name: Lint All
run: ./scripts/lint_all.sh
# lint:
# name: Lint check
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# architecture: 'x64'
# - name: Install Lint tools
# run: pip install --upgrade pip setuptools; pip install -r requirements.txt;
# - name: Lint All
# run: ./scripts/lint_all.sh

format:
name: Formatting check
runs-on: ubuntu-20.04
# format:
# name: Formatting check
# runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.10'
architecture: 'x64'
- name: Install Format tools
run: pip install --upgrade pip setuptools; pip install -r requirements.txt; sudo apt-get install -y clang-format-6.0
- name: Format Check
run: ./scripts/format_check.sh
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# architecture: 'x64'
# - name: Install Format tools
# run: pip install --upgrade pip setuptools; pip install -r requirements.txt; sudo apt-get install -y clang-format-6.0
# - name: Format Check
# run: ./scripts/format_check.sh

wheel-build:
name: Wheel test
runs-on: ubuntu-20.04
# wheel-build:
# name: Wheel test
# runs-on: ubuntu-20.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: Build Wheel Test
run: ./scripts/build_pip_package_test.sh
- name: Test Wheel
run: ./scripts/run_example.sh
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# 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: 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: ubuntu-20.04
needs: [lint, format]
# bazel-tests:
# name: Library tests
# runs-on: ubuntu-20.04
# needs: [lint, format]

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: Full Library Test
run: ./scripts/test_all.sh
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# 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: Full Library Test
# run: ./scripts/test_all.sh

leak-tests:
name: Memory Leak tests
runs-on: ubuntu-20.04
needs: [lint, format]
# needs: [lint, format]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: Check out a copy of the TFQ repository.
uses: actions/checkout@v4

- name: Set up Bazel.
uses: bazel-contrib/[email protected]
env:
USE_BAZEL_VERSION: 6.5.0
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true

- name: Set up Python.
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
- name: Configure CI TF

- name: Set up cache for Python dependencies.
uses: actions/cache@v4
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
enableCrossOsArchive: true

- name: Install Python dependencies if needed.
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt

- name: Configure TF and TFQ.
run: echo "Y\n" | ./configure.sh
- name: Leak Test qsim and src
run: ./scripts/msan_test.sh

tutorials-test:
name: Tutorial tests
runs-on: ubuntu-20.04
needs: [lint, format, wheel-build]
- name: Perform memory leakage test on qsim and TFQ src.
run: ./scripts/msan_test.sh 2>&1 | tee bazel-output.log
continue-on-error: true

steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: Save Bazel output as downloadable artifacts.
uses: actions/upload-artifact@v4
with:
python-version: '3.10'
architecture: 'x64'
- name: Install notebook dependencies
run: pip install --upgrade pip seaborn==0.10.0
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
- name: Configure CI TF
run: echo "Y\n" | ./configure.sh
- name: Build Wheel
run: ./scripts/build_pip_package_test.sh
- name: Test Notebooks
run: ./scripts/ci_validate_tutorials.sh
name: bazel-out
retention-days: 7
include-hidden-files: true
path: |
bazel-output.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

# saving-test:
# name: Test saving artifactes
# runs-on: ubuntu-20.04
# steps:
# - name: Make a test file
# run: echo test > test.log
# - name: Save artifacts
# uses: actions/upload-artifact@v4
# with:
# name: foo
# path: test.log


# tutorials-test:
# name: Tutorial tests
# runs-on: ubuntu-20.04
# needs: [lint, format, wheel-build]

# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# architecture: 'x64'
# - name: Install notebook dependencies
# run: pip install --upgrade pip seaborn==0.10.0
# - name: Install Bazel on CI
# run: ./scripts/ci_install.sh
# - name: Configure CI TF
# run: echo "Y\n" | ./configure.sh
# - name: Build Wheel
# run: ./scripts/build_pip_package_test.sh
# - name: Test Notebooks
# run: ./scripts/ci_validate_tutorials.sh
17 changes: 12 additions & 5 deletions .github/workflows/cirq_compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
jobs:
consistency:
name: Nightly Compatibility
runs-on: ubuntu-16.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.10'
architecture: 'x64'
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
Expand All @@ -21,4 +21,11 @@ jobs:
- name: Install Cirq nightly
run: pip install -U cirq --pre
- name: Nightly tests
run: ./scripts/test_all.sh
run: ./scripts/msan_test.sh
# run: ./scripts/test_all.sh

- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: /home/runner/.cache/bazel/_bazel_runner/**/execroot/__main__/bazel-out/
51 changes: 35 additions & 16 deletions scripts/msan_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,14 @@
# limitations under the License.
# ==============================================================================
echo "Testing All Bazel cc_tests with msan.";
test_outputs=$(bazel test -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" \
--cxxopt="-msse2" --cxxopt="-msse3" --cxxopt="-msse4" \

export ASAN_OPTIONS=debug=1:check_initialization_order=true:detect_invalid_pointer_pairs=1

test_outputs=$(bazel test -c dbg --cxxopt="-g" --cxxopt="-fno-omit-frame-pointer" \
--cxxopt="-fsanitize=address" --linkopt="-fsanitize=address" \
--cxxopt="-g" --cxxopt="-O0" \
--notest_keep_going --test_output=errors \
//tensorflow_quantum/core/src:all && \
bazel test -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" \
--cxxopt="-mavx2" --cxxopt="-mavx" --cxxopt="-mfma" \
--cxxopt="-fsanitize=address" --linkopt="-fsanitize=address" \
--cxxopt="-g" --cxxopt="-O0" \
--notest_keep_going --test_output=errors \
//tensorflow_quantum/core/src:all && \
bazel test -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" \
--cxxopt="-fsanitize=address" --linkopt="-fsanitize=address" \
--cxxopt="-g" --cxxopt="-O0" \
--notest_keep_going --test_output=errors \
--color=no --show_progress_rate_limit=0 --test_summary=short \
--announce_rc --subcommands --verbose_failures --show_timestamps \
--keep_going --test_output=errors \
//tensorflow_quantum/core/src:all)
exit_code=$?
if [ "$exit_code" == "0" ]; then
Expand All @@ -39,4 +31,31 @@ else
echo "Testing failed, please correct errors before proceeding."
echo "{$test_outputs}"
exit 64;
fi
fi

# test_outputs=$(bazel test -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" \
# --cxxopt="-msse2" --cxxopt="-msse3" --cxxopt="-msse4" \
# --cxxopt="-fsanitize=address" --linkopt="-fsanitize=address" \
# --cxxopt="-g" --cxxopt="-O0" \
# --notest_keep_going --test_output=errors \
# //tensorflow_quantum/core/src:all && \
# bazel test -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" \
# --cxxopt="-mavx2" --cxxopt="-mavx" --cxxopt="-mfma" \
# --cxxopt="-fsanitize=address" --linkopt="-fsanitize=address" \
# --cxxopt="-g" --cxxopt="-O0" \
# --notest_keep_going --test_output=errors \
# //tensorflow_quantum/core/src:all && \
# bazel test -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" \
# --cxxopt="-fsanitize=address" --linkopt="-fsanitize=address" \
# --cxxopt="-g" --cxxopt="-O0" \
# --notest_keep_going --test_output=errors \
# //tensorflow_quantum/core/src:all)
# exit_code=$?
# if [ "$exit_code" == "0" ]; then
# echo "Testing Complete!";
# exit 0;
# else
# echo "Testing failed, please correct errors before proceeding."
# echo "{$test_outputs}"
# exit 64;
# fi
Loading