use matrix for testing action with specified C and CXX compiler

This commit is contained in:
Alfi Maulana 2023-01-08 12:44:44 +07:00
parent 2511f03a88
commit c7a5566aa6
No known key found for this signature in database
GPG Key ID: 2242A64C2A8DF5A4

View File

@ -55,6 +55,9 @@ jobs:
use-action-with-specified-compiler: use-action-with-specified-compiler:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
lang: [C, CXX]
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3.3.0 uses: actions/checkout@v3.3.0
@ -63,11 +66,14 @@ jobs:
uses: ./ uses: ./
with: with:
source-dir: test source-dir: test
c-compiler: clang c-compiler: ${{ matrix.lang == 'C' && 'clang' || '' }}
cxx-compiler: clang++ cxx-compiler: ${{ matrix.lang == 'CXX' && 'clang++' || '' }}
args: |
-D BUILD_C=${{ matrix.lang == 'C' && 'ON' || 'OFF' }}
-D BUILD_CXX=${{ matrix.lang == 'CXX' && 'ON' || 'OFF' }}
- name: Run build result - name: Run build result
run: build/hello_world run: build/${{ matrix.lang == 'C' && 'hello_world_c' || 'hello_world' }}
use-action-with-additional-args: use-action-with-additional-args:
runs-on: ubuntu-latest runs-on: ubuntu-latest