• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: build-and-test
2
3on:
4  push: {}
5  pull_request: {}
6
7jobs:
8  # TODO: add 32-bit builds (g++ and clang++) for ubuntu
9  #   (requires g++-multilib and libc6:i386)
10  # TODO: add coverage build (requires lcov)
11  # TODO: add clang + libc++ builds for ubuntu
12  job:
13    name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.compiler }}
14    runs-on: ${{ matrix.os }}
15    strategy:
16      fail-fast: false
17      matrix:
18        os: [ubuntu-latest, ubuntu-20.04, macos-latest]
19        build_type: ['Release', 'Debug']
20        compiler: [g++, clang++]
21        include:
22          - displayTargetName: windows-latest-release
23            os: windows-latest
24            build_type: 'Release'
25          - displayTargetName: windows-latest-debug
26            os: windows-latest
27            build_type: 'Debug'
28    steps:
29      - uses: actions/checkout@v2
30
31      - name: create build environment
32        run: cmake -E make_directory ${{ runner.workspace }}/_build
33
34      - name: configure cmake
35        env:
36          CXX: ${{ matrix.compiler }}
37        shell: bash
38        working-directory: ${{ runner.workspace }}/_build
39        run: >
40          cmake $GITHUB_WORKSPACE
41          -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
42          -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
43
44      - name: build
45        shell: bash
46        working-directory: ${{ runner.workspace }}/_build
47        run: cmake --build . --config ${{ matrix.build_type }}
48
49      - name: test
50        shell: bash
51        working-directory: ${{ runner.workspace }}/_build
52        run: ctest -C ${{ matrix.build_type }} -VV
53
54  ubuntu-16_04:
55    name: ubuntu-16.04.${{ matrix.build_type }}.${{ matrix.compiler }}
56    runs-on: [ubuntu-latest]
57    strategy:
58      fail-fast: false
59      matrix:
60        build_type: ['Release', 'Debug']
61        compiler: [g++, clang++]
62    container: ubuntu:16.04
63    steps:
64      - uses: actions/checkout@v2
65
66      - name: install required bits
67        run: |
68          apt update
69          apt -y install clang cmake g++ git
70
71      - name: create build environment
72        run: cmake -E make_directory $GITHUB_WORKSPACE/_build
73
74      - name: configure cmake
75        env:
76          CXX: ${{ matrix.compiler }}
77        shell: bash
78        working-directory: ${{ github.workspace }}/_build
79        run: >
80          cmake $GITHUB_WORKSPACE
81          -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
82          -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
83
84      - name: build
85        shell: bash
86        working-directory: ${{ github.workspace }}/_build
87        run: cmake --build . --config ${{ matrix.build_type }}
88
89      - name: test
90        shell: bash
91        working-directory: ${{ github.workspace }}/_build
92        run: ctest -C ${{ matrix.build_type }} -VV
93
94  ubuntu-14_04:
95    name: ubuntu-14.04.${{ matrix.build_type }}.${{ matrix.compiler }}
96    runs-on: [ubuntu-latest]
97    strategy:
98      fail-fast: false
99      matrix:
100        build_type: ['Release', 'Debug']
101        compiler: [g++-4.8, clang++-3.6]
102        include:
103          - compiler: g++-6
104            build_type: 'Debug'
105            run_tests: true
106          - compiler: g++-6
107            build_type: 'Release'
108            run_tests: true
109    container: ubuntu:14.04
110    steps:
111      - uses: actions/checkout@v2
112
113      - name: install required bits
114        run: |
115          sudo apt update
116          sudo apt -y install clang-3.6 cmake3 g++-4.8 git
117
118      - name: install other bits
119        if: ${{ matrix.compiler }} == g++-6
120        run: |
121          sudo apt -y install software-properties-common
122          sudo add-apt-repository -y "ppa:ubuntu-toolchain-r/test"
123          sudo apt update
124          sudo apt -y install g++-6
125
126      - name: create build environment
127        run: cmake -E make_directory $GITHUB_WORKSPACE/_build
128
129      - name: configure cmake
130        env:
131          CXX: ${{ matrix.compiler }}
132        shell: bash
133        working-directory: ${{ github.workspace }}/_build
134        run: >
135          cmake $GITHUB_WORKSPACE
136          -DBENCHMARK_ENABLE_TESTING=${{ matrix.run_tests }}
137          -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
138          -DBENCHMARK_DOWNLOAD_DEPENDENCIES=${{ matrix.run_tests }}
139
140      - name: build
141        shell: bash
142        working-directory: ${{ github.workspace }}/_build
143        run: cmake --build . --config ${{ matrix.build_type }}
144
145      - name: test
146        if: ${{ matrix.run_tests }}
147        shell: bash
148        working-directory: ${{ github.workspace }}/_build
149        run: ctest -C ${{ matrix.build_type }} -VV
150