Files
carbon-lang/.github/workflows/tests.yaml
T
Chandler Carruth 5d6593ee39 Speed up and simplify the configuration of testing CI. (#335)
This is primarily using the configuration matrix facilities of GitHub
actions to consolidate the overall configuration. Beyond avoiding
duplication, this also allows the default and release builds to run in
parallel. The checkout time is duplicated between these, but the rest of
the time is nicely parallelized. This has the most dramatic effect on
macOS builds. Overall, this should reduce the latency on testing from
22-28 minutes to 15-20 minutes from what I've seen which seems
worthwhile.

This does reduce the detail provided in the names of the different
configurations. However, the Bazel build mode is preserved. That seems
like the most critical pieces of information.

Much of this started with me just trying to learn more about GitHub
actions, but once understanding how the job matrix worked, it seemed
worthwhile to send out as an actual change.
2021-03-05 18:35:30 -08:00

61 lines
1.7 KiB
YAML

# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: test
on:
push:
branches: [trunk]
pull_request:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build_mode: [fastbuild, opt]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
# Setup Python and related tools.
- uses: actions/setup-python@v2
with:
python-version: '3.8.5'
- name: Install python modules
run: |
pip install gql PyGitHub
# On macOS we need Go and to use it to install Bazelisk.
- uses: actions/setup-go@v2
if: matrix.os == 'macos-latest'
- name: Install bazelisk
if: matrix.os == 'macos-latest'
run: |
go get github.com/bazelbuild/bazelisk
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
# Print the various tool versions to help in debugging.
- name: Print tool versions
run: |
bazelisk --version
python --version
echo gql "$(pip show gql | grep Version)"
echo PyGitHub "$(pip show PyGitHub | grep Version)"
# Build all targets first to isolate build failures.
- name: Build (${{ matrix.build_mode }})
run: |
bazelisk build -c ${{ matrix.build_mode }} --verbose_failures \
//...:all
# Run all test targets.
- name: Test (${{ matrix.build_mode }})
run: |
bazelisk test -c ${{ matrix.build_mode }} --test_output errors \
--verbose_failures //...:all