Run tests #197
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: Run tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: "30 8 * * *" # runs every day at 8:30 am | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit-test: | |
strategy: | |
matrix: | |
compilation-mode: | |
- fastbuild | |
- opt | |
- dbg | |
bazel-version: | |
- 7.x | |
runner: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
- ubuntu-24.04 | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Look up cache if it's not a scheduled job | |
if: ${{ github.event_name != 'schedule' }} | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.cache | |
key: ${{ github.repository }}-${{ github.job }}-${{ matrix.bazel-version }}-${{ matrix.compilation-mode }}-${{ runner.os }}-${{ hashFiles('.bazelrc', 'WORKSPACE', 'MODULE.bazel') }} | |
restore-keys: ${{ github.repository }}-${{ github.job }}-${{ matrix.bazel-version }}-${{ matrix.compilation-mode }}-${{ runner.os }}- | |
- name: Set up | |
uses: ./.github/actions/setup | |
with: | |
bazel-version: ${{ matrix.bazel-version }} | |
- name: Unit test | |
shell: bash | |
run: ./development/cli/run_unit_test.bash -c "${COMPILATION_MODE}" | |
env: | |
COMPILATION_MODE: ${{ matrix.compilation-mode }} | |
integration-test: | |
strategy: | |
matrix: | |
compilation-mode: | |
- fastbuild | |
- opt | |
- dbg | |
bazel-version: | |
- 7.x | |
runner: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
- ubuntu-24.04 | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Look up cache if it's not a scheduled job | |
if: ${{ github.event_name != 'schedule' }} | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/integration_test/bazel/.cache | |
key: ${{ github.repository }}-${{ github.job }}-${{ matrix.bazel-version }}-${{ matrix.compilation-mode }}-${{ runner.os }}-${{ hashFiles('.bazelrc', 'WORKSPACE', 'MODULE.bazel', 'integration_test/bazel/.bazelrc', 'integration_test/bazel/WORKSPACE', 'integration_test/bazel/MODULE.bazel') }} | |
restore-keys: ${{ github.repository }}-${{ github.job }}-${{ matrix.bazel-version }}-${{ matrix.compilation-mode }}-${{ runner.os }}- | |
- name: Set up | |
uses: ./.github/actions/setup | |
with: | |
bazel-version: ${{ matrix.bazel-version }} | |
- name: Integration test | |
shell: bash | |
run: ./development/cli/run_integration_test.bash -c "${COMPILATION_MODE}" | |
env: | |
COMPILATION_MODE: ${{ matrix.compilation-mode }} | |
style-check: | |
runs-on: ubuntu-latest | |
env: | |
bazel-version: 7.x | |
strategy: | |
matrix: | |
style-checker: | |
- buildifier.bash | |
- clang_format.bash | |
- clang_tidy_integration_test.bash | |
- clang_tidy_root.bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Set up | |
uses: ./.github/actions/setup | |
with: | |
bazel-version: ${{ env.bazel-version }} | |
- name: Look up cache if it's not a scheduled job | |
if: ${{ github.event_name != 'schedule' }} | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.cache | |
key: ${{ github.repository }}-${{ github.job }}-${{ env.bazel-version }}-${{ matrix.style-checker }}-${{ runner.os }}-${{ hashFiles('.bazelrc', 'WORKSPACE', 'MODULE.bazel') }} | |
restore-keys: ${{ github.repository }}-${{ github.job }}-${{ env.bazel-version }}-${{ matrix.style-checker }}-${{ runner.os }}- | |
- name: Run formatters and linters | |
shell: bash | |
run: "./development/cli/style_check/${STYLE_CHECKER}" | |
env: | |
STYLE_CHECKER: ${{ matrix.style-checker }} | |
- name: Fail if some files are changed | |
shell: bash | |
run: | | |
if ! git diff --exit-code; then | |
echo "ERROR: Files are changed by formatters" >&2 | |
exit 1 | |
fi | |
all-tests-passable: | |
if: always() | |
needs: | |
- unit-test | |
- integration-test | |
- style-check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |