Use bazel-contrib/setup-bazel instead of manually installing a deb during CI #1660
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bazel | |
on: | |
push: | |
# Run post-submit tests when pushing to master. | |
branches: | |
- master | |
pull_request: | |
jobs: | |
# Run tests with Bazel v5.3.0. | |
test: | |
name: Test with Bazel | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
# Hardware optimizers. | |
hardware_opt: [avx,sse,basic] | |
# Optimizers for parallelism. | |
parallel_opt: [openmp,nopenmp] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: bazel-contrib/[email protected] | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
bazelisk-version: 1.x | |
- name: Checkout submodules | |
run: git submodule update --init --recursive | |
- name: Install requirements | |
run: | | |
python3 -m pip install -r requirements.txt | |
- name: Run C++ tests | |
run: | | |
bazel test --config=${{ matrix.hardware_opt }} \ | |
--config=${{ matrix.parallel_opt }} tests:all | |
- name: Run sample simulation | |
run: | | |
bazel run --config=${{ matrix.hardware_opt }} \ | |
--config=${{ matrix.parallel_opt }} apps:qsim_base \ | |
-- -c circuits/circuit_q24 | |
test-san: | |
name: Sanitizer tests | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
# Test sanitizers | |
sanitizer_opt: [msan,asan] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: bazel-contrib/[email protected] | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
bazelisk-version: 1.x | |
- name: Checkout submodules | |
run: git submodule update --init --recursive | |
- name: Install requirements | |
run: | | |
python3 -m pip install -r requirements.txt | |
- name: Upgrade libc | |
# An LLVM update broke this test, fix per is https://bugs.llvm.org/show_bug.cgi?id=27310. | |
run: | | |
sudo apt update | |
sudo apt-get upgrade libc-bin | |
- name: Run C++ tests | |
run: | | |
bazel test --config=avx --config=openmp \ | |
--config=${{ matrix.sanitizer_opt }} tests:all | |
test-mem: | |
name: Test with tcmalloc | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: bazel-contrib/[email protected] | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
bazelisk-version: 1.x | |
- name: Checkout submodules | |
run: git submodule update --init --recursive | |
- name: Install requirements | |
run: | | |
python3 -m pip install -r requirements.txt | |
- name: Install google-perftools for tcmalloc | |
run: sudo apt-get install libgoogle-perftools-dev | |
- name: Run C++ tests | |
run: | | |
bazel test --config=avx --config=openmp \ | |
--config=tcmalloc tests:all |