replace language matrix in use-action-with-specified-compiler job with os matrix

This commit is contained in:
Alfi Maulana 2023-01-11 13:22:25 +07:00
parent 4ba6e49b5d
commit 0321b5f0a7
No known key found for this signature in database
GPG Key ID: 2242A64C2A8DF5A4

View File

@ -40,38 +40,28 @@ jobs:
run: test ! -d build run: test ! -d build
use-action-with-specified-compiler: use-action-with-specified-compiler:
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
lang: [C, CXX] os: [windows-latest, ubuntu-latest, macos-latest]
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3.3.0 uses: actions/checkout@v3.3.0
- name: Use this action with specified invalid compiler
id: failed_step
continue-on-error: true
uses: ./
with:
source-dir: test
c-compiler: ${{ matrix.lang == 'C' && 'invalid' || '' }}
cxx-compiler: ${{ matrix.lang == 'CXX' && 'invalid' || '' }}
- name: Check if previous step is failing
run: ${{ steps.failed_step.outcome == 'failure' && 'true' || 'false' }}
- name: Use this action with specified compiler - name: Use this action with specified compiler
uses: ./ uses: ./
with: with:
source-dir: test source-dir: test
c-compiler: ${{ matrix.lang == 'C' && 'clang' || '' }} c-compiler: clang
cxx-compiler: ${{ matrix.lang == 'CXX' && 'clang++' || '' }} cxx-compiler: clang++
args: | args: |
-D BUILD_C=${{ matrix.lang == 'C' && 'ON' || 'OFF' }} -D BUILD_C=ON
-D BUILD_CXX=${{ matrix.lang == 'CXX' && 'ON' || 'OFF' }} -D BUILD_CXX=ON
- name: Run build result - name: Run build result
run: build/${{ matrix.lang == 'C' && 'hello_world_c' || 'hello_world' }} run: |
{{ matrix.os == 'windows-latest' && 'build\Debug\hello_world.exe' || 'build/hello_world' }}
{{ matrix.os == 'windows-latest' && 'build\Debug\hello_world_c.exe' || 'build/hello_world_c' }}
use-action-with-specified-generator: use-action-with-specified-generator:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}