-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (57 loc) · 2.73 KB
/
main.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
70
71
name: BuildAndRunStuff
on:
pull_request:
push:
branches: [ 'main', 'beta' ]
workflow_dispatch:
inputs:
extra_flags:
description: "Extra flags to pass to bazel"
default: ''
required: false
jobs:
build-with-bazel:
name: ${{matrix.cfg.name}}
runs-on: ${{matrix.cfg.os}}
strategy:
matrix:
cfg:
- { name: 'Linux GCC', output: 'linux_gcc_libstdcxx', os: 'ubuntu-22.04', cc: 'g++', flags: }
- { name: 'Linux LLVM/libstdc++', output: 'linux_llvm_libstdcxx', os: 'ubuntu-22.04', cc: 'clang++', flags: }
- { name: 'Linux LLVM/libc++', output: 'linux_llvm_libcxx', os: 'ubuntu-22.04', cc: 'clang++', flags: '--config=libc++' }
- { name: 'MacOS GCC', output: 'macos_gcc_libstdcxx', os: 'macos-12', cc: 'g++-11', flags: }
- { name: 'MacOS LLVM/libc++', output: 'macos_llvm_libcxx', os: 'macos-12', cc: 'clang++', flags: }
env:
CC: ${{matrix.cfg.cc}}
BAZEL_USE_CPP_ONLY_TOOLCHAIN: 1
steps:
- name: check out repository
uses: actions/checkout@v2
- name: install infrastructure (Linux)
if: matrix.cfg.os == 'ubuntu-22.04'
run: sudo ln -s /usr/lib/llvm-10/include/c++/v1 /usr/include/c++/v1
- name: build
run: bazel build --show_result=100 -c opt --dynamic_mode=off ${{matrix.cfg.flags}} ${{github.event.inputs.extra_flags}} //...
- name: test
run: bazel test --test_output=errors --show_result=100 -c opt --dynamic_mode=off ${{matrix.cfg.flags}} ${{github.event.inputs.extra_flags}} //...
- name: run (Linux)
if: matrix.cfg.os == 'ubuntu-22.04'
run: |
file bazel-bin/sandbox/dso_loader bazel-bin/sandbox/dso_demo.so
ldd bazel-bin/sandbox/show_args bazel-bin/sandbox/dso_loader bazel-bin/sandbox/dso_test bazel-bin/sandbox/dso_demo.so
bazel-bin/sandbox/show_args foo bar quz
bazel-bin/sandbox/dso_loader bazel-bin/sandbox/dso_demo.so
- name: run (MacOS)
if: matrix.cfg.os == 'macos-12'
run: |
file bazel-bin/sandbox/dso_loader bazel-bin/sandbox/dso_demo.so
otool -L -H bazel-bin/sandbox/show_args bazel-bin/sandbox/dso_loader bazel-bin/sandbox/dso_test bazel-bin/sandbox/dso_demo.so
bazel-bin/sandbox/show_args foo bar quz
bazel-bin/sandbox/dso_loader bazel-bin/sandbox/dso_demo.so
- name: make tarball
run: tar cf output-${{matrix.cfg.output}}.tar -C bazel-bin/sandbox dso_demo.so dso_loader dso_test show_args
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: build_outputs.zip
path: output-${{matrix.cfg.output}}.tar