Add a test for the output of a binary signaling an error #2689
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
# Copyright 2021, 2022, 2023, 2024 Google LLC | |
# | |
# 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: Run Bazel tests | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
permissions: | |
contents: read | |
jobs: | |
test: | |
name: Test | |
strategy: | |
matrix: | |
# We don’t use the GitHub matrix support for the Emacs toolchain to | |
# allow Bazel to cache intermediate results between the test runs. | |
bazel: [6.3.2, 6.5.0, 7.1.2, latest] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
cc: [gcc, clang, msvc] | |
exclude: | |
# Visual C++ works only on Windows. Windows doesn’t use the CC | |
# environment variable and always uses Visual C++ by default. | |
- os: ubuntu-latest | |
cc: msvc | |
- os: macos-latest | |
cc: msvc | |
- os: windows-latest | |
cc: gcc | |
- os: windows-latest | |
cc: clang | |
# Exclude non-default compilers for now. We should add them later. | |
- os: macos-latest | |
cc: gcc | |
fail-fast: false | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up workspace | |
uses: ./.github/actions/set-up | |
with: | |
bazel-version: ${{matrix.bazel}} | |
cc: ${{matrix.cc}} | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
- name: Set lockfile mode | |
# The lockfile format differs between the Bazel versions, so only for | |
# one version --lockfile_mode=error can work. --lockfile_mode=update | |
# would be useless since we never use the updated lockfiles, so switch | |
# lockfiles off entirely in other Bazel versions. | |
shell: bash | |
run: >- | |
echo common | |
--lockfile_mode=${{matrix.bazel == 'latest' && 'error' || 'off'}}>> | |
github.bazelrc | |
- name: Run Bazel tests | |
shell: pwsh | |
run: python build.py --profiles='${{runner.temp}}/profiles' -- check | |
- name: Upload profiles | |
uses: actions/upload-artifact@v4 | |
with: | |
name: >- | |
profiles for Bazel version ${{matrix.bazel}} on ${{runner.os}} | |
compiled with ${{matrix.cc}} | |
path: ${{runner.temp}}/profiles/*.json.gz | |
if-no-files-found: ignore |