-
Notifications
You must be signed in to change notification settings - Fork 21
69 lines (63 loc) · 2.13 KB
/
build_and_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Workflow for building and testing flags on macOS, Ubuntu and Windows.
name: Build and Run all tests
# We use action's triggers 'push' and 'pull_request'.
# The strategy is the following: this action will be
# triggered on any push to 'main' branch and any pull
# request to any branch. Thus we avoid duplicate work-
# flows.
on:
push:
branches:
- "main"
pull_request:
branches:
- "**"
workflow_dispatch:
inputs:
# Live debug failures using tmate by toggling input parameter
# 'debug_enabled':
# https://github.com/mxschmitt/action-tmate#manually-triggered-debug
# When manually running this workflow:
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
debug_enabled:
description: "Enable tmate debugging"
type: boolean
default: false
jobs:
build-and-test:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
# 'windows-latest' (windows-2022) is broken due to a github runner update.
# See https://github.com/actions/runner-images/issues/7662 for more details.
os: ["macos-latest", "ubuntu-latest", "windows-2019"]
defaults:
run:
shell: bash
steps:
# Checkout the repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Build
run: |
bazel build \
-c dbg \
--strip="never" \
...
- name: Test
run: |
bazel test \
-c dbg \
--strip="never" \
--test_output=errors \
tests/... \
--test_arg=--gtest_shuffle \
--test_arg=--gtest_repeat=100
- name: Debug using tmate (if failure)
uses: mxschmitt/action-tmate@v3
# Optionally enable tmate debugging if the workflow was manually-triggered
# with `debug_enabled` set to `true`.
# https://github.com/mxschmitt/action-tmate#manually-triggered-debug
if: ${{ failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}