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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
name: Test
permissions:
contents: read
on:
workflow_call:
inputs:
compiler:
description: 'the C++ compiler to use'
type: string
required: true
standard:
description: 'the C++ standard to use'
type: number
required: true
mode:
description: 'build mode (debug, dev or release)'
type: string
required: true
enables:
description: 'the --enable-* option passed to configure.py'
type: string
default: ''
required: false
enable-ccache:
description: 'build with ccache enabled'
type: boolean
default: true
required: false
options:
description: 'additional options passed to configure.py'
type: string
default: ''
required: false
jobs:
test:
timeout-minutes: 40
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: "${{ contains(inputs.enables, 'dpdk') }}"
- run: |
sudo apt-get update
- name: Install build dependencies
run: |
sudo ./install-dependencies.sh
- name: Install clang++
if: ${{ inputs.compiler == 'clang++' }}
run: |
sudo apt-get -y install clang
- name: Install clang-scan-deps
if: ${{ contains(inputs.enables, 'cxx-modules') }}
run: |
sudo apt-get -y install clang-tools
- name: Install ccache
if: ${{ inputs.enable-ccache }}
run: |
sudo apt-get -y install ccache
- name: Setup ccache
if: ${{ inputs.enable-ccache }}
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ inputs.compiler }}-${{ inputs.standard }}-${{ inputs.mode }}-${{ inputs.enables }}
- name: Configure
run: |
if [ ${{ inputs.compiler }} = "clang++" ]; then
CC=clang
else
CC=gcc
fi
if ${{ inputs.enable-ccache }}; then
MAYBE_CCACHE_OPT="--ccache"
fi
./configure.py \
--c++-standard ${{ inputs.standard }} \
--compiler ${{ inputs.compiler }} \
--c-compiler $CC \
--mode ${{ inputs.mode }} \
$MAYBE_CCACHE_OPT \
${{ inputs.options }} \
${{ inputs.enables }}
- name: Build
run: cmake --build build/${{inputs.mode}}
- name: Check Header
if: ${{ inputs.mode == 'dev' && inputs.compiler == 'clang++' }}
run: cmake --build build/${{ inputs.mode }} --target checkheaders
- name: Check Include Style
if: ${{ inputs.mode == 'dev' && inputs.compiler == 'clang++' }}
run: cmake --build build/${{ inputs.mode }} --target check-include-style
- name: Build with C++20 modules
if: ${{ contains(inputs.enables, 'cxx-modules') }}
run: cmake --build build/${{ inputs.mode }} --target hello_cxx_module
- name: Test
if: ${{ ! contains(inputs.enables, 'cxx-modules') }}
run: ./test.py --mode=${{ inputs.mode }}
|