From c7a5566aa68d2efba3657a3981d2891bd4b71dd7 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sun, 8 Jan 2023 12:44:44 +0700 Subject: [PATCH] use matrix for testing action with specified C and CXX compiler --- .github/workflows/test.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d9a62b..33af546 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,9 @@ jobs: use-action-with-specified-compiler: runs-on: ubuntu-latest + strategy: + matrix: + lang: [C, CXX] steps: - name: Checkout repository uses: actions/checkout@v3.3.0 @@ -63,11 +66,14 @@ jobs: uses: ./ with: source-dir: test - c-compiler: clang - cxx-compiler: clang++ + c-compiler: ${{ matrix.lang == 'C' && '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 - run: build/hello_world + run: build/${{ matrix.lang == 'C' && 'hello_world_c' || 'hello_world' }} use-action-with-additional-args: runs-on: ubuntu-latest